How to get textbox value in jQuery
In this tutorial, we will explain to you how to get textbox value in jQuery. you can easily get the textbox value after the button click event or change event.
In this example, we are getting the textbox value using jQuery. we will get value using the particular element object. so here for get inputbox value, we are use val() function of jQuery.
So you can see below our example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>How to get textbox value in jQuery - XpertPhp</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ $("#btn").click(function(){ var getVal = $("#txtname").val(); alert(getVal); }); }); </script> </head> <body> <input type="text" id="txtname" /> <button type="button" id="btn">Get Value</button> </body> </html> |
Read Also
how to get textbox value in javascript
How To Remove Empty Object From JSON In JavaScript
Allow Only Numbers In Textbox Javascript Onkeypress
Please follow and like us: