-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