jQuery: il metodo toArray() in dettaglio

jQuery: il metodo toArray() in dettaglio

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>]
Torna su