Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
As soon as you select it, it's already an array. For example, you could do this:
Code:
var inputs = $("input[name='table[]']")
for(var i = 0; i < inputs.length; i++) {
document.write(inputs[i].value);
}
The only disadvantage of doing it this way is if you select a member through its index, you can't chain special jQuery methods to it, such as .each(), or .val().
jQuery selection always returns an array, even if it is only one member. The value of each index in the array is the "raw" DOM object. For example:
Code:
alert($('#unique').html());
is the same as:
Code:
alert($('#unique')[0].innerHTML);
Last edited by wayfarer07; 03-06-2010 at 05:34 PM..
|