The function of your plugin is to trigger the event 'myEvent'.
The first time you invoke the hilight() method but now the 'myEvent' event
not bind to '#myDiv',so you cannot get the alert information.
The second time you click, the '#myDiv' has bind 'myEvent' one time, so you
get the alert informa
i usually use something like this when coding a jQuery plugin.
(function() {
var newMethods = {
// function start
AddTo : function(options) {
var defaults = {
// set default option values here
};
var options = $.extend(defaults, options); // access any options
below
Hi all,
I am learning how to author jquery plug in and trying to fire a custom event
using trigger and bind. However, for some reason, when I click the button
first time, the custom event is not called. If I click again, the event will
execute once. If I click the third time, the event will execu
3 matches
Mail list logo