I would like to know how to make this code work: http://jsfiddle.net/LBXVd/2/. It's almost clean jqueryboilerplate, I'm interested in this part of code:
Plugin.prototype = {
init: function() {
/// create element <a> with click function
myEl = $('<a/>', {
href: '#',
text: '###',
click: function(e){this._handler();}
});
$('ul').before(myEl);
},
//handler for click events on my <a> element...
_handler: function(el, options) {
alert("my handler called");
}
};
How can I call function _handler after click on created element?
Thanks!