我有一個網頁形式,我會用一個按鈕喜歡只對輸入文本復位按鈕的效果這裏面一個div是我的代碼extraxt:jQuery函數清空了一些要素形式
HTML:
<div id="new_prom" style="clear:both; padding:2px; border:1px solid red; margin:5px;">
<div>
Codice <input type="text" id="cod_pro" name="cod_pro" class="short"> Sottocodice <input type="text" id="sotto_pro" name="sotto_pro" class="short"><br>
Nominativo<br>
<input type="text" id="nom_pro" name="nom_pro" class="long">
</div>
<div>
<div class="bt" id="bt_pro">INSERISCI</div> <div class="bt" id="resetta">RESET</div>
</div>
的jQuery:
$("#resetta").live('click', function()
{
$("#new_prom > text").each(function(){$(this).val("")});
});
在此先感謝。
ciao,h。
我已經tryed你的代碼,但在我的情況不工作:( – haltman 2010-07-13 18:27:32
感謝尼克Craver和自旋子說的工作代碼爲我: $(「#resetta」)生活(「點擊」,功能( ) \t { \t $( 「#new_prom:文本」)每個(函數(){$(本).VAL( 「」)}); \t}); – haltman 2010-07-13 18:36:43
@haltman - 同樣,你不需要'.each()',看看我上面的代碼... – 2010-07-13 18:37:39