Jquery中判断是否含有某种属性

来源:互联网 发布:如何投诉淘宝店铺客服 编辑:程序博客网 时间:2024/05/18 00:36

 

如<input superior="11" value='test'>

可以用typeof把$(this).attr("superior")转成类型与undefined相比较:

 if(typeof($(this).attr("superior"))!="undefined")

            $("#"+this.attributes.superior.nodeValue).attr('checked',true); 

        });


$("#id")的内容如下:


  1. 0:input#m1-7
  2. context:document
  3. length:1
  4. selector:"#m1-7"
  5. __proto__:Object[0]
使用get(0)可以获取input#m1-7


0 0