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