星空网 > 软件开发 > Java

jQuery 判断是否包含某个属性

1、Get the attribute, check the value

var attr = $(this).attr('name');// For some browsers, `attr` is undefined; for others, `attr` is false. Check for both.if (typeof attr !== typeof undefined && attr !== false) { // Element has this attribute}

2、Native JavaScript has a way

$(this)[0].hasAttribute("name");jQObject[0].hasAttribute("name");

3、Filter the selection

$(this).is('[name]');$(this).filter("[name='choice']");

 




原标题:jQuery 判断是否包含某个属性

关键词:jquery

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

空运物流快递:https://www.goluckyvip.com/tag/102824.html
空运快递:https://www.goluckyvip.com/tag/102825.html
快递空运:https://www.goluckyvip.com/tag/102826.html
厦门货运空运:https://www.goluckyvip.com/tag/102827.html
空运运输:https://www.goluckyvip.com/tag/102828.html
运输空运:https://www.goluckyvip.com/tag/102829.html
永康白云风景区怎么走 白云山风景区怎么去??:https://www.vstour.cn/a/363181.html
2022世界杯门票如何买?:https://www.vstour.cn/a/363182.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流