Home > DeveloperSection > Forums > How to get element name of value?
Ankita Pandey
Ankita Pandey

Total Post:183

Posted on    October-04-2014 4:00 AM

 JQuery JavaScript  JQuery 

 1 Reply(s)
 887  View(s)
Rate this:
need to get all text of value, then use json to send the value to insert all of price to the database, but i had the problem, i can't get the text of all value where input text name='price'. here this is HTML code:
here is Html code:

<input type='text' id='price1' name='price[]'/>


<input type='text' id='price2' name='price[]'/>


<button type='button' id='btn'/>

JQuery code:



    $('#btn').click(function (e) {

        var myprice = [];

        myprice = $("*[name='price']").val();




                type: "insert",

                price: myprice,


        ).done(function (data) {





Kamlakar Singh
Kamlakar Singh

Total Post:194

Posted on    October-04-2014 4:02 AM

you can use .map() to get all values


    var myprice = $.map($('[name="price[]"]'), function (v, i) {

        return v.value;



Don't want to miss updates? Please click the below button!

Follow MindStick