JQuery Form Value Example
Simple JQuery example to get the HTML form field value using JQuery. HTML contains various element like text field, text area, radio button, check boxes etc. You can easily get the value of form field using JQuery.
This tutorial explain you how to get the text field and text area value using JQuery.
To get value of HTMLinput field.
$("input").val();
To get value of HTML Text area field.
$("textarea").val();
JQuery example
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ alert("Text field value- " + $("#test").val()); alert("Text area value- " + $("#test1").val()); }); }); </script> </head> <body> Name: <input type="text" id="test" value="umar farooque"> <textarea id="test1"> ptutorial </textarea> <button>Get form field values</button> </body> </html>
To learn more about JQuery example and see a lot of live example visit: JQuery Example
Do not forgot to like share and comment