How to get/set input box value in jQuery

By | August 8, 2020
Whether you are developing an ERP application or you are creating a simple form, sometimes you need to get input box value in a variable so that you can use it in your function or somewhere else where you want to. So, here in this post i m going to share with you a small tricks to get or set the value in a text box using jQuery method val().
 

How to set input box value using jQuery

To set the value in a text box field use below code:
 

$("#txt_name").val('value')

How to get input box value using jQuery

$("#txt_name").val();
Above code will return the current value of the input box.

Please do let me know your feedback on this small tutorial in the comment box below.

Leave a Reply

Your email address will not be published. Required fields are marked *