我有点业余,所以我不知道如何实现这个目标。 我有一些需要切换加号或减号的按钮:
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();
});
});
如何使用已有的代码实现此目的?
我希望具有与以下示例相同的功能:
如有任何帮助,我们将不胜感激,提前谢谢您。
最佳答案
将以下代码添加到事件处理程序:
$(this).find('[id^=myButton]').val(function(i,v) {
return v.trim() == '+' ? '-' : '+';
});
$('.expandable').not(this).find('input[type="button"]').val("+");
关于Jquery 加号和减号按钮切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26513031/