views:

71

answers:

5

How can i get the input element value in jquery

+2  A: 
$("#elementId").val()
Bozho
+3  A: 

If this is your textbox:

<input type="text" id="mytextBox" value="" />

You will be getting it's value using the textbox's ID=mytextBox...

var value = $("#mytextBox").val()

References

Garis Suero
+2  A: 

use jQuery('inputElement').val() to get the values of input(form) elements

sushil bharwani
A: 

The best way is to use the val() function, as in:

$('#someInput').val();

You can also use the attr function to find the value for some fields

$('#someInput').attr('value');
Kranu
+1  A: 

The val function gets or sets the value of an input field.

Set the input value to "Hello world":

$('#myInput').val('Hello world');

Get the input value:

$('#myInput').val();
Konal