Il metodo size() di jQuery è deprecato
Invece del metodo size() di jQuery occorre usare la proprietà length per ottenere il numero di elementi presenti in un set.
Il metodo size(), in origine usato per reperire il numero di elementi presenti in un set jQuery, è stato deprecato. Vediamo i dettagli di questo problema.
La documentazione ufficiale afferma:
The
.size()method is functionally equivalent to the.lengthproperty; however, the.lengthproperty is preferred because it does not have the overhead of a function call.
Quindi occorre usare length. Esempio:
alert($('li').length); // 5
Commenti