Jquery Append在Drupal中不起作用

Jquery Append在Drupal中不起作用,jquery,drupal-7,Jquery,Drupal 7,我想在drupal中的表后面添加两个按钮。我使用表id和append,但它不起作用。我不知道是什么问题,控制台中没有显示错误 这是代码。请帮忙 (function($){ $('#edit-submitted-new-table-element').appendTo('<a href="javascript:void(0);" class="addmorebtn form-submit">Add More</a> <a href="javascript:void

我想在drupal中的表后面添加两个按钮。我使用表id和append,但它不起作用。我不知道是什么问题,控制台中没有显示错误

这是代码。请帮忙

(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
您正在使用appendTo而不是append来介绍代码。更改它:

$('#edit-submitted-new-table-element').append(...)
您还必须更改正在使用的选择器。例如,最后一个孩子是不正确的。将其更改为:

$('#edit-submitted-new-table-element tr:last-child')...
$('#edit-submitted-new-table-element tr.odd:last-child').removeAttr('style');
$('#edit-submitted-new-table-element tr.even:nth-last-child').removeAttr('style');
希望有帮助。

尝试更改$'edit-submitted-new-table-element'。附加到$'edit-submitted-new-table-element'。附加