欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實(shí)現(xiàn)contains方法不區(qū)分大小寫的方法

 更新時(shí)間:2015年02月13日 11:23:30   作者:apollokk  
這篇文章主要介紹了jQuery實(shí)現(xiàn)contains方法不區(qū)分大小寫的方法,實(shí)例分析了針對(duì)contains方法的重寫技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了jQuery實(shí)現(xiàn)contains方法不區(qū)分大小寫的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

// 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;
};

用法:

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

測(cè)試HTML文件:

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

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論