本文介绍了点击按钮添加行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!



我的Html

 < table name =mytable2width =100pxborder =0cellspacing =0cellpadding =0style =padding-top:5px> 
< tr class =stname =st>
< td width =80pxstyle =text-align:center; padding-top:3px;>
< input type =Textid =newstname =newstmaxlength =25style =width:80px; font-family:Tahoma; font-size:11px;><< ; / TD>
< td width =20px>
< input type =submitname =plusid =plusvalue =+style =width:20px; text-align:center;>< / td>
< / tr>
< / table>

我在用什么:

 < script type =text / javascript> 
$(document).ready(function(){
$(#plus)。click(function(){
$('#mytable2 tbody> tr:last')。 clone(true).insertAfter('#mytable2 tbody> tr:last');
$('#mytable2 tbody> tr:last #st')。val('');
$(' val('');
$('#mytable2 tbody> tr:last #plus')。val('+');
return false ;
});
});


任何人都可以帮忙吗? p>

解决方案

id 不是名称:)

< table name =mytable2



Trying to add a row of this table when you click the input "plus".

My Html

<table name="mytable2" width="100px"  border="0" cellspacing="0" cellpadding="0" style="padding-top:5px">
    <tr class="st" name="st">
    <td width="80px" style="text-align:center; padding-top:3px;">
    <input type="Text" id="newst" name="newst" maxlength="25" style="width:80px; font-family:Tahoma; font-size:11px;"></td>
    <td width="20px">
    <input type="submit" name="plus" id="plus" value="+" style="width:20px; text-align:center;"></td>
    </tr>
</table>

What I'm using:

<script type="text/javascript">
$(document).ready(function() {
    $("#plus").click(function() {
$('#mytable2 tbody>tr:last').clone(true).insertAfter('#mytable2 tbody>tr:last');
$('#mytable2 tbody>tr:last #st').val('');
    $('#mytable2 tbody>tr:last #newst').val('');
            $('#mytable2 tbody>tr:last #plus').val('+');
return false;
    });
});

Could anyone help?

解决方案

id not name :)

<table name="mytable2"


<table id="mytable2"

http://jsfiddle.net/brentmn/whgy6/

这篇关于点击按钮添加行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 20:48