I'm tryign to add the click event on my tag but It seems not working. I got always the error:
Uncaught TypeError: ((m.event.special[e.origType] || (intermediate value)).handle || e.handler).apply is not a function
at HTMLAnchorElement.dispatch (jquery-1.11.1.min.js:3)
at HTMLAnchorElement.r.handle (jquery-1.11.1.min.js:3)
Here my code:
this.drawButtons = function(id,buttons) {
var buttonsArea = $("#"+((id!=null)?id:"buttons"));
buttonsArea.append("<div class='pull-right'><table><tr class='buttonsrow' ></tr></table></div>");
if(buttons != null) {
var row = $("");
var a;
for(var i=0;i<buttons.length;i++) {
a = $("<a href='#' title='"+buttons[i].title+"' "+
"class='"+buttons[i].size+"-button' "+
"style='margin-right: 5px; margin-top: 3px; background-image:url(../images/buttons/"+buttons[i].image+");' ></a>");
if(buttons[i].action!=null)
a.click(buttons[i].action);
buttonsArea.find(".buttonsrow").append($("<td></td>").append(a));
}
}
}
The function that I pass is like this:
var prova = new function() {
var buttons =
[
[
{
title: "save",
size: "medium",
image: "save.png",
action: "prova.test1()"
},
{
title: "back",
size: "small",
image: "back.png",
action: "prova.showPage();"
}
]
];
this.showPage = function() {
}
}