// NEW selector
jQuery.expr[':'].Contains = function(a, i, m) {
return jQuery(a).text().toUpperCase()
.indexOf(m[3].toUpperCase()) >= 0;
};
// OVERWRITES old selecor
jQuery.expr[':'].contains = function(a, i, m) {
return jQuery(a).text().toUpperCase()
.indexOf(m[3].toUpperCase()) >= 0;
};
//该代码片段来自于: http://www.sharejs.com/codes/javascript/4289
用法:
$("div:contains('John')") Test HTML:
<div>john</div> <div>John</div> <div>hey hey JOHN hey hey</div>