這裏是我的代碼引導HTML點擊按鈕而不提交表單
<form class="form-horizontal">
<div class="control-group">
<div class="controls">
<button onclick="javascript:add_user_group(2);" class="btn">add</button>
</div>
</div>
<table id="users-table" class="table table-striped" >
<thead>
<tr>
<th>User Name</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</form>
我只是想一個新的行添加到時添加按鈕點擊表,但似乎添加按鈕的點擊觸發提交的形式。
是不是隻與
type=submit
一個按鈕提交表單。或者表單中的任何按鈕觸發表單提交?
我不熟悉bootstrap,但如果在添加行後使'add_user_group()'函數返回false,會發生什麼? – 2013-02-22 19:32:29
@AnthonyClark waw。它的作品(不會觸發表單提交)! – icn 2013-02-22 19:34:37