Skip to content
Fix Code Error

Get the value in an input text box

March 13, 2021 by Code Error
Posted By: Anonymous

What are the ways to get and render an input value using jQuery?

Here is one:

$(document).ready(function() {
  $("#txt_name").keyup(function() {
    alert($(this).val());
  });
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<input type="text" id="txt_name" />

Solution

//Get
var bla = $('#txt_name').val();

//Set
$('#txt_name').val(bla);
Answered By: Anonymous

Related Articles

  • How do I rotate text in css?
  • Is CSS Turing complete?
  • classify data into categories using python
  • sql query to find priority jobs
  • Add JsonArray to JsonObject
  • setTimeout function not working : javascript
  • how to use canvas in JavaScript flappy bird code
  • Navbar not filling width of page when reduced to mobile view
  • collision detection from picturebox in a list c#
  • How do i update a javascript variable as its value changes?

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

How to remove local (untracked) files from the current Git working tree

Next Post:

Echo newline in Bash prints literal n

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Get code errors & solutions at akashmittal.com
© 2022 Fix Code Error