0

Let's say you have:

onclick="alert('12345678900012jjuu12dwsda'); console.log('dadsad');"

Now imagine you have hundreds of html5 elements, buttons, divs, etc… and you want all of them to share the very same behavior, that is, when clicked, all of them should display the same message.

If it was a graphical issue, for instance, if one wanted all elements to share the same shade of green, one creates a CSS class and applies it.

Is there something analog for the case described above?

Preferably plain js.

thanks

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • 4
    Make one click event listener for all of the elements. http://stackoverflow.com/questions/7556564/vanilla-javascript-version-of-jquery-click – Leeish Apr 29 '16 at 21:37
  • You are aware that what very little uninformative code you have won't give you anything on the console, right? How is something analog in this context? – zer00ne Apr 29 '16 at 23:48

0 Answers0