jQuery .toggle event deprecated, What to use? -


since jquery .toggle event method deprecated. suppose use simulate event (alternate clicks)?

add outside of document.ready

$.fn.clicktoggle = function(a, b) {     return this.each(function() {         var clicked = false;         $(this).click(function() {             if (clicked) {                 clicked = false;                 return b.apply(this, arguments);             }             clicked = true;             return a.apply(this, arguments);         });     }); }; 

then use following replicate .toggle functionality:

$("#mydiv").clicktoggle(functiona,functionb); 

found on jquery forums


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -