X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

jQuery Misc toArray() Method

jQuery Misc Methods jQuery Misc Methods

Example

Convert the <li> elements to an array, then alert the innerHTML of the array elements:

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

Try it yourself »

Definition and Usage

The toArray() method returns the elements matched by the jQuery selector as an array.


Syntax

$(selector).toArray()


jQuery Misc Methods jQuery Misc Methods


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook