When we develop with jquery, we encounter a situation where name has multiple or similar name. At this point we need to get a value for one of them or to get their values separately, we can use jquery to get an array of objects before we get one of them. First put the code on:
Description
Mode one: var orderId = $ ("input[name= ' Jqueryarray ')") [0].value;
$ ("input[name=' Jqueryarray ')") [0] is an input object, so you can directly use the native JS object. value to get
Way two:$ ($ ("Input[name= ' Jqueryarray ')") [i]). Val ();
$ (" Input[name= ' Jqueryarray ') ") [i] is an input object , So you can't call the Val () method in jquery, if you want to use the Val () method in jquery, you need to $ (" Input[name= ' Jqueryarray ' ] ") [i] to the jquery object, which is $ ($ ("Input[name= ' Ajaxorderid ')") [i]);Way Three: $ ("input[name^= ' Jqueryarray ')"). each (function (i) {if (i = = 2) alert (this.value);});
Use the Each () function of jquery to loop around and get the values. Note that this is the native DOM object.
jquery Gets the value of an array object