您的位置:首页 > Web前端 > JQuery

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

2016-08-23 09:41 148 查看
 

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

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

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

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

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

0:input#m1-7
context:document
length:1
selector:"#m1-7"
__proto__:Object[0]

使用get(0)可以获取input#m1-7
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: