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
2 matches
Mail list logo