我有一個button input
,我要禁用它是這樣的:改變與jQuery的的document.ready標籤的屬性複製它
$(document).ready(function() {
if ($('#participants tr').length < 3)
jQuery("#send").attr('disabled', true);
else
jQuery("#send").attr('disabled', false);
});
它成功地禁止,但是當啓用條件爲真,這部分被複制在嵌套方式:
編輯:
<form>
<fieldset>
<table id="participants">
....
</table>
</fieldset>
</form>
<input type="button" value="send" onClick="sendMail()" id="send" />
<fieldset>
...
<form>
<table id="participants">
<tr>
<td><a onClick='f(id)' >del</a></td>
</tr>
</table>
</form>
</fieldset>
<input type="button" value="send" onClick="sendMail()" id="send" />
這table
有p的某些行參與者每行都有一個del鏈接,點擊它會導致從數據庫和表中刪除參與者,當表中的行數小於3時我將禁用send button
爲什麼?
你必須要更加明確。它重複了什麼? – Purag 2012-03-02 06:06:18
我在這段代碼中沒有看到任何東西,使它重複另一個按鈕 – XepterX 2012-03-02 06:08:40
@Purmou:對不起!我編輯了這個問題。 – 2012-03-02 06:13:54