gpt4 book ai didi

Jquery Toggle 两个功能在 1.10.1 中不起作用

转载 作者:行者123 更新时间:2023-12-03 22:53:52 24 4
gpt4 key购买 nike

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com