获取input标签的所有属性的方法
1.用jquery
$("input[name='btnAdd']").attr("value")
获取value属性值,其它属性换attr的参数就OK
2.通过点来获取:
<!doctypehtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>Document</title>
</head>
<body>
<formid="form1"name="form1">
<inputname="n1"type="text"/>
<inputname="n3"type="text"/>
<inputname="n4"type="text"/>
</form>
<script>
window.onload=function(){
varinputs=document.form1.getElementsByTagName("input");
for(vari=0;i<inputs.length;i++){
inputs[i].onclick=function(){
alert(this.name);
};
}
};
</script>
</body>
</html>
以上就是小编为大家带来的获取input标签的所有属性的方法全部内容了,希望大家多多支持毛票票~