Skip to content Skip to sidebar Skip to footer

I Want To Get All Textbox Values Using Jquery And Make Them All Null On Onchange Event

I'm trying to get all values within a form using jQuery and want to set all those as a value null. Now I have text also and hidden fields also. ).val('');

But this everyone will tell to you in different ways. What you should know is:

Your html element must have the attribute NAME, if you want to get all the values from the form(as you commented). You can't use $('#frm1').serialize() for example.

Solution 2:

try this:

$('#TransactionGrid').find("input[type='text']").each(function (index) {
   //get valuevar val = $(this).val();
   //set this value to ''
   $(this).val('');
   //to hide
   $(this).hide();
});

Solution 3:

$('#TransactionGrid').find("input[type=\'text\']").each(function (index) {

//Setting the value to null i.e '';

 $(this).val('');

//if u want to hide it u can use .hide...

    $(this).hide();

 });

Solution 4:

Try with this

functionresetAllValues() {
         $("input:text", "#TransactionGrid").val('');
         $("input:hidden", "#TransactionGrid").val('00000000-0000-0000-0000-000000000000');
}

Post a Comment for "I Want To Get All Textbox Values Using Jquery And Make Them All Null On Onchange Event"