Getting an input element's value in jQuery

Rakesh Sabbani picture Rakesh Sabbani · Sep 9, 2010 · Viewed 23.2k times · Source

How can I get the value of an input element in jQuery?

Answer

Garis M Suero picture Garis M Suero · Sep 9, 2010

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