Posts: 3,570
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);
__________________
Wayfarer | bBoard
If Google is the Coca-Cola of Web search, Bing is RC Cola
Last edited by wayfarer07; 03-06-2010 at 04:34 PM..
|