Latest web development tutorials

jQuery Miscellaneous toArray () method

jQuery Misc Methods jQuery Misc Methods

Examples

The <li> elements into an array, then the output of the array element innerHTML:

$("button").click(function(){
x=$("li").toArray()
for (i=0;i<x.length;i++)
{
alert(x[i].innerHTML);
}
});

try it"

Definition and Usage

toArray () method returns an array of jQuery selectors match elements.


grammar

$(selector).toArray()


jQuery Misc Methods jQuery Misc Methods