How can I get the value of an input element in jQuery?
If this is your textbox :
textbox
<input type="text" id="mytextBox" value="" />
You will get its value using the text field ID=mytextBox ...
value
ID=mytextBox
var value = $("#mytextBox").val()
$("#elementId").val()
The best way is to use the val() function, as in:
val()
$('#someInput').val();
You can also use the attr function to find the value for some fields.
$('#someInput').attr('value');
The val function gets or sets the value of an input field.
val
Set the input value to "Hello world":
$('#myInput').val('Hello world');
Get input value:
$('#myInput').val();
use jQuery ('inputElement'). val () to get input element (form) values