So I would like to create a function from this:
element.onclick = function(e){
... code ...
}
To something like this:
element.onclick = doSomething(e);
element2.onclick = doSomething(e);
function doSomething(e){
... code ...
}
In this way I could call the function multiple times but in this way e
is not passed as an event so doesn't works.
How should I do this?
Sry If I say something stupid, this thing is a bit hard to me