码迷,mamicode.com
首页 > Web开发 > 详细

jQuery实现contains方法不区分大小写的方法教程

时间:2017-05-11 10:21:26      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:john   log   expr   用法   方法   exp   turn   text   return   

jQuery.expr[‘:‘].Contains = function(a, i, m){
 return jQuery(a).text().toUpperCase()
   .indexOf(m[3].toUpperCase()) >= 0;
};  

用法:

$("div:contains(‘John‘)")

测试HTML文件:

<div>john</div>
<div>John</div>
<div>hey hey JOHN hey hey</div>

jQuery实现contains方法不区分大小写的方法教程

标签:john   log   expr   用法   方法   exp   turn   text   return   

原文地址:http://www.cnblogs.com/dancesir/p/6839317.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!