【发布时间】:2014-08-13 10:41:05
【问题描述】:
我想在 drupal 中的表格后添加两个按钮。我使用表 id 和追加,但它不工作。我不知道是什么问题,控制台中没有显示错误。
这里是代码。请帮忙
(function($){
$('#edit-submitted-new-table-element').appendTo('<a href="javascript:void(0);" class="addmorebtn form-submit">Add More</a> <a href="javascript:void(0);" class="hidebtn form-submit">Hide it</a>');
$('.hidebtn').css('display', 'none');
alert('h1');
var numcount = 0;
$('#edit-submitted-new-table-element .addmorebtn').live('click', function(){
numcount++;
if(numcount >0 && numcount < 2){
$('#edit-submitted-new-table-element tr:nth-last-child(2)').css('display', ' table-row');
}
else if(numcount >1 && numcount < 3){
$('#edit-submitted-new-table-element tr:last-child()').css('display', ' table-row');
$('.addmorebtn').css('display', 'none');
$('.hidebtn').removeAttr('style');
$('.hidebtn').css('display', 'inlne-block');
}
});
$('#edit-submitted-new-table-element .hidebtn').live('click', function(){
if(numcount >= 2 && numcount < 3){
$('#edit-submitted-new-table-element tr:last-child().odd').removeAttr('style');
}
else if(numcount >=1 && numcount < 2){
$('#edit-submitted-new-table-element tr:nth-last-child(2).even').removeAttr('style');
$('.hidebtn').css('display', 'none');
$('.addmorebtn').removeAttr('style');
$('.addmorebtn').css('display', 'inline-block');
}
numcount--;
});
}(jQuery));
I want to add two button after table in drupal. I use table id and append but it is not working...
I don't know what is the problem and no error is showing in console.
Here is code . Please help
【问题讨论】:
-
尝试将
$('#edit-submitted-new-table-element').appendTo(改为$('#edit-submitted-new-table-element').append(