投入要素和錶行的新行我有以下代碼:添加使用JQuery
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#add, .check ").click(function() {
$('#mytable tbody>tr:last').clone(true).insertAfter('#mytable tbody>tr:last');
return false;
});
});
</script>
隨着由身體下面:
<form action='demo.php' method='post'>
<a id="add">+</a></td>
<table id="mytable" width="300" border="1" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td>Name</td>
</tr>
<tr class="person">
<td><input type="text" name="name[]" class='check' /></td>
</tr>
</tbody>
</table>
<input type='submit' />
</form>
我怎樣才能得到它清除場添加它們後,可能會添加一個效果,如淡入或向下滑動等等。另外,我希望如果最後一行中的任何表單元素被聚焦,它會自動添加一個新行,但無法弄清楚如何訪問最後一行的表單元素...:\
我已經降落在這個頁面上,同時尋找一種方式來添加一個表格,已經存在的表格。我懷疑你的標題不完全準確,看來你的表單已經存在沒有jQuery。這是真的?如果是這樣,你會考慮改變標題嗎? – Tass