Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jqueryappend正在添加额外的行_Jquery - Fatal编程技术网

jqueryappend正在添加额外的行

jqueryappend正在添加额外的行,jquery,Jquery,我想向表中添加一个新行,该行已添加,但每次添加该行时,都会在添加的行的顶部添加一个额外的行,似乎无法找到问题的原因,请有人帮助我吗 这是我的密码 $('.addbtn').on('click',function(e){ var chkedItem = $('input:checked'); // get the checked <td> var chkItemcol = chkedItem.parent().siblings('td'); //

我想向表中添加一个新行,该行已添加,但每次添加该行时,都会在添加的行的顶部添加一个额外的行,似乎无法找到问题的原因,请有人帮助我吗 这是我的密码

$('.addbtn').on('click',function(e){
    var chkedItem = $('input:checked');
    // get the checked <td>
        var chkItemcol = chkedItem.parent().siblings('td');
    // get the checked row numbers of columns
        var chklen = chkItemcol.length;
    //get the texts in the table columns
        chkedItem.each(function(e){
                $this = $(this);
                var qtyclicked = 1;
                var createrow ="<tr><td><input type='hidden' name='qtyclick' class='qtyclick' value='"+qtyclicked+"'/>"+qtyclicked+"</td>";
                // iterate through the columns. 
                for(var i = 0; i<chklen; i++){
                    // add class to the item name
                        if(i == 0){
                                createrow += "<td class='name'>";
                        }else{
                                createrow += "<td>";
                        }
                        createrow += $this.parent().siblings('td').eq(i).text();
                        createrow += "</td>";
                    //alert(createrow);
                }
                createrow += "</tr>";

                    $('.ordertable > tbody:last').append(createrow);


        });
 e.preventDefault();
});
$('.addbtn')。在('click',函数(e)上{
var chkedItem=$('input:checked');
//检查一下
var chkItemcol=chkedItem.parent().sibbines('td');
//获取列的选中行号
var chklen=chkItemcol.length;
//获取表列中的文本
chkedItem.each(函数(e){
$this=$(this);
var-qtyclicked=1;
var createrow=“”+qtyclicked+”;
//遍历列。
对于(var i=0;i
新行添加到的表

<TABLE class="ordertable" style="width:100%; border-collapse:collapse; border: solid 1px #000000">
        <TBODY>

</TBODY></TABLE>


提前感谢

您是否同时选中了多个复选框? jQuery代码将为每个选中的复选框创建一个新表行

<TABLE class="ordertable" style="width:100%; border-collapse:collapse; border: solid 1px #000000">
        <TBODY>

</TBODY></TABLE>