jQuery 判断是否包含某个属性
2015-12-28 22:07
603 查看
1、Get the attribute, check the value
2、Native JavaScript has a way
3、Filter the selection
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 自动补全插件 autocomplete
- Java程序员之JS(一) 之 JQuery.ajax
- 20151227:Jquery元素选取及取值<转>
- 20151227:Jquery
- JQuery中$.ajax()方法参数详解
- jquery中之get和post的区别
- jquery ajax complete 方法
- 使用jquery改变元素在页面的位置--offsetTop,screenTop,clientTop关系及理解
- jquery通过数值改变球大小
- jQuery学习--jQuery DOM 操作
- jQuery 双击事件(dblclick)时,不触发单击事件(click)
- jQuery子窗体取得父窗体元素的方法
- Jquery动画操作的stop()函数
- JQuery使用方法及详解
- 解密jQuery内核 DOM操作的核心函数domManip
- Asp.net mvc 添加Jquery UI
- JQuery 中的事件命名空间
- jquery图片轮播效果代码
- 58种jQuery模拟CSS3过渡页面切换特效
- 使用jquery.cookie.js插件实现记住密码功能