ボタンをクリックしてクリックした行を削除しようとしました。ボタン上の行を削除する
"追加"ボタンがうまくいきました。
HTML:
<table id="mytable" width="250px" border="0" cellspacing="0" cellpadding="0" style="text-align:center;>
<thead>
<tr class="product">
<th style="text-align:center;"><strong>Item</strong></th>
<th style="text-align:center;"><strong>Qty.</strong></th>
<th style="text-align:center;"><strong>Remarks</strong></th>
</tr>
</thead>
<tr name="product" class="product">
<td width="100px"><input type="text" width="100px" name="product" id="product" /></td>
<td width="5px"><input type="text" width="5px" size="1" maxlength="2" name="qty" id="qty" /></td>
<td width="100px"><input type="text" width="100px" height="14px" name="remarks" id="remarks" /></td>
<td><input type="submit" name="add" id="add" value="+" /></td>
<td><input type="submit" name="subtract" id="subtract" value="-" /></td>
</tr>
</table>
私が使用しているもの:
<script type="text/javascript">
$(document).ready(function() {
$("#add").click(function() {
$('#mytable tbody>tr:last').clone(true).insertAfter('#mytable tbody>tr:last');
$('#mytable tbody>tr:last #product').val('');
$('#mytable tbody>tr:last #qty').val('');
$('#mytable tbody>tr:last #remarks').val('');
$('#mytable tbody>tr:last #add').val('+');
return false;
});
});
を誰が助けてもらえますか?
ただし、解決策の1つが問題の解決に役立った場合は、その解決策を受け入れる必要があります。チェックボックスをクリックするだけです。 –