jQuery Toggle的两个功能在1.10.1中不起作用 [英] Jquery Toggle two function not work in 1.10.1
本文介绍了jQuery Toggle的两个功能在1.10.1中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
jquery切换两个功能在jquery 1.10.1中不起作用,但在jquery 1.8.3中起作用
Jquery Toggle two function not work in jquery 1.10.1 but work's on 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.');
});
,示例为此处
推荐答案
老兄,它在jQuery 1.10.1中不起作用
Dude it doesn't works in jQuery 1.10.1
还有另一种方法...
Still there is another way to do it...
$(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中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文