I am trying to create functions with the same name as the buttons' ids
var a = ["ab1","aj6","yt5","gf5","js9"]
for (i = 0; i < a.length; i++) {
var el = a[i];
function el(){
list.find(el);
}
$(function() {
$("#"+el).click(el);
}
}
When I do this, I get an
Uncaught TypeError: Cannot read property 'handler' of undefined on the anonymous function
. But when I change the function name to say "calculate" rather then the var el
, it works fine. Any ideas?