用jquery获取input输入框的值有多种方法,可以通过id、name、type等属性指定获取。
比如想要获取下面input的输入值,通常有以下方法:
<input id="test" name="test" type="text"/>
<script>
$(" #test ").val() //通过id
$(" input[ name='test' ] ").val() //通过name
$(" input[ type='text' ] ").val() //通过type
$(" input[ type='text' ]").attr("value")
</script>
声明:如需转载,请注明来源于www.webym.net并保留原文链接:http://www.webym.net/jiaocheng/1054.html





















