JS添加标签

<script>
            function show(){
                $('.add').unbind();
                $('.low').unbind();

                $('.add').click(function(){ // 加好;
                    var html=$(this).closest('tr').html();
                    var str='<tr class="tr">'
                        str+='<td><input name="material[]" type="text" /></td>'
                        str+='<td><input name="size[]" type="text" /></td>'
                        str+='<td><input name="membrane[]" type="text" /></td>'
                        str+='<td><input name="angle[]" type="text" /></td>'
                        str+='<td><input name="moq[]" type="text" /></td>'
                        str+='<td><input name="price[]" type="text" /></td>'
                        str+='<td><input name="duration[]" type="text" /></td>'
                        str+='<td><a href="javascript:;" class="low">-</a><a href="javascript:;" class="add">+</a></td>'
                        str+='</tr>'
                    $('.tbody').append(str);
                    // $(this).remove();
                    show();
                })

                $('.low').click(function(){ // 剑豪
                    if($('.tbody tr').length > 1){
                        $(this).parents('tr').remove();
                    }
                })    
            }
            show();
        </script>

posted on 2016-07-22 16:05  Mr.风的影子  阅读(375)  评论(0编辑  收藏  举报

导航