Skip to content Skip to sidebar Skip to footer

Get The Value From Html Form Using Jquery

I want to get the values if HTML form using jquery. In my form here is two div info1 and info2 and in the jquery I have two variable store and store2 value of info1 is save in vari

Solution 1:

Your code is working, to check the values in console, try this:

 $(document).on('click','#btn',function(){
     var store = [];
     var store2 = [];

     $('#info1 :input[type="text"]').map(function(){
        var values = $(this).val();
       store.push({values:values});
          });
     $('#info2 :input[type="text"]').map(function(){
        var values = $(this).val();
       store2.push({values:values});
          });

     console.log(store);
     console.log(store2); 
 });

Post a Comment for "Get The Value From Html Form Using Jquery"