Quote Originariamente inviata da lucavizzi Visualizza il messaggio
Se gli elementi cui associare l'evento fossero davvero molti, esistono degli approcci per evitare di associare un evento ad ogni singolo elemento, migliorando così le performances generali. Con jQuery si può usare delegate.
Leggevo giusto di quanto hai scritto sul sito di jquery relativamente a delegate e ho scoperto che:
As of jQuery 1.7, .delegate() has been superseded by the .on() method. For earlier versions, however, it remains the most effective means to use event delegation. More information on event binding and delegation is in the .on() method. In general, these are the equivalent templates for the two methods: