-1
我可以使用它的名稱屬性而不是Id屬性獲取文本框的值到jquery中。 例如獲取文本框的值到jquery
<input type = "text" name="text-box" value='1'/>
我可以使用它的名稱屬性而不是Id屬性獲取文本框的值到jquery中。 例如獲取文本框的值到jquery
<input type = "text" name="text-box" value='1'/>
是的,當然。試試看:
$('input[name="text-box"]').val();
我正在嘗試使用此代碼。但它不適合我。你能幫我 $(document).ready(function(){ $('input [name =「text-box」]')。keypress(function(e){ if(e.which! = 8 && e.which!= 0 &&(e.which <48 || e.which> 57)){(「#errmsg」)。html(「Digits Only」)。show()。fadeOut 「slow」); return false; } }); }); – 2015-02-24 16:12:36
您顯示錯誤,然後將其隱藏。一切看起來不錯。 – 2015-02-24 21:40:53