Jquery Toggle two function not work in jquery 1.10.1 but work\'s on Jquery 1.8.3
HTML
For example, consider the HTML:
DEMO
DEMO jQuery 2.x (edge)
use this clickToggle
plugin as toggle
function is removed from version 1.9
(function ($) {
$.fn.clickToggle = function (func1, func2) {
var funcs = [func1, func2];
this.data('toggleclicked', 0);
this.click(function () {
var data = $(this).data();
var tc = data.toggleclicked;
$.proxy(funcs[tc], this)();
data.toggleclicked = (tc + 1) % 2;
});
return this;
};
}(jQuery));
$('#target').clickToggle(function () {
alert('First handler for .toggle() called.');
}, function () {
alert('Second handler for .toggle() called.');
});