Saturday, 17 August 2013

How to use jQuery on to attach to the click event of a button by ID

How to use jQuery on to attach to the click event of a button by ID

//Add solve puzzle buttons
jSolvePuzzleButtonsHTML = "<div><button id=\"bsolveacross\">solve word
across</button><button id=\"bsolvedown\">solve word
down</button><button id=\"bsolvepuzzle\">solve puzzle</button></div>";
jQuery("#gridpuzzlewrapper").append(jSolvePuzzleButtonsHTML);
jQuery("#bsolvedown").on('click', '#bsolvedown', function() {
alert("click called...");
});
For some reason my click event is not firing.
Thanks in advance...

No comments:

Post a Comment