Jquery Toggle 两个函数在 jquery 1.10.1 中不起作用,但在 Jquery 1.8.3 中起作用
HTML
<p>For example, consider the HTML:</p>
<div id="target">
Click here
</div>
Jquery
$('#target').toggle(function() {
alert('First handler for .toggle() called.');
}, function() {
alert('Second handler for .toggle() called.');
});
示例为here
最佳答案
Dude it doesn't works in jQuery 1.10.1
还有另一种方法可以做到这一点......
$(function () {
function first() {
//Code for first time click goes here
$(this).one("click", second);
}
function second() {
//Code for second time click goes here
$(this).one("click", first);
}
$("#target").one("click", first);
});
关于Jquery Toggle 两个功能在 1.10.1 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18206021/