jQuery: il metodo toArray() in dettaglio

Il metodo toArray() trasforma un set di elementi jQuery in un array JavaScript.

jQuery di Gabriele Romanato

Il metodo toArray() trasforma un set di elementi jQuery in un array JavaScript. Vediamolo in dettaglio.

Sintassi di base

$( elementi ).toArray()

Esempio:


console.log( $( "li" ).toArray() );

Che produce:

[<li>, <li>]

Commenti