gpt4 book ai didi

Jquery 加号和减号按钮切换

转载 作者:行者123 更新时间:2023-12-01 06:33:50 25 4
gpt4 key购买 nike

我有点业余,所以我不知道如何实现这个目标。我有一些需要切换加号或减号的按钮:

http://jsfiddle.net/tonylka10/0eq456w9/

Jquery:

$(document).ready(function () {
$('.expandable').click(function () {
$('.expandable').not(this).nextAll('tr').hide();
$(this).nextAll('tr').toggle(350);

});
$('.expandable').nextAll('tr').each(function () {
if (!($(this).is('.expandable'))) $(this).hide();
});
});

如何使用已有的代码实现此目的?

我希望具有与以下示例相同的功能:

http://jsfiddle.net/v9Evw/1/

如有任何帮助,我们将不胜感激,提前谢谢您。

最佳答案

将以下代码添加到事件处理程序:

    $(this).find('[id^=myButton]').val(function(i,v) { 
return v.trim() == '+' ? '-' : '+';
});
$('.expandable').not(this).find('input[type="button"]').val("+");

DEMO

关于Jquery 加号和减号按钮切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26513031/

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