欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

獲取input標(biāo)簽的所有屬性的方法

 更新時(shí)間:2016年06月28日 10:06:34   投稿:jingxian  
下面小編就為大家?guī)硪黄@取input標(biāo)簽的所有屬性的方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

1.用jquery

$("input[name='btnAdd']").attr("value")  

獲取value屬性值,其它屬性換attr的參數(shù)就OK

2.通過點(diǎn)來獲取:

<!doctype html>
<html lang="en">
 <head>
 <meta charset="UTF-8">
 <title>Document</title>
 </head>
 <body>
 <form id="form1" name="form1">
<input name="n1" type="text" />
<input name="n3" type="text" />
<input name="n4" type="text" />
</form>


<script>
window.onload = function(){
  var inputs = document.form1.getElementsByTagName("input");
  for(var i = 0; i < inputs.length; i++) {
    inputs[i].onclick = function(){
      alert(this.name);
    };
  }
};

</script>
 </body>
</html>

以上就是小編為大家?guī)淼墨@取input標(biāo)簽的所有屬性的方法全部?jī)?nèi)容了,希望大家多多支持腳本之家~

相關(guān)文章

最新評(píng)論