3
I have a list of id’s on buttons:
<button id="grafico01">Pontuação por MARCAS</button>
<button id="grafico02">Pontuação por EQUIPAMENTOS</button>
<button id="grafico03">RAZÃO da Pontuação</button>
... that become functions:
function grafico01(){...
function grafico02(){...
function grafico03(){...
I deal with a function that gets the button Ids:
$("button[id^=grafico]").click(function() {...
Depending on the ID’s, call the corresponding function, but I haven’t been succeeding with typeof and instanceof.
Have some way I call these functions through a received name, like PHP callable running?
Is it necessary for me to throw the functions into a variable? That way encapsulated it could work as much as the answer above. I will test.
– William Aparecido Brandino
We respond almost simultaneously with the same answer :)
+1
– Sergio
Yap :) @Sergio. I’ve also put you
+1
– Miguel
For my functionality, both worked, but @Sergio’s wiped my code more.
– William Aparecido Brandino
No problem @Williamasimiliar, they both work but you have to accept the best for you
– Miguel