Make jQuery: केस-असंवेदनशील - सीएसएस-ट्रिक्स

Anonim
// 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; );

JQuery 1.8 के लिए काम करने के लिए अद्यतन

$.expr(":").contains = $.expr.createPseudo(function(arg) ( return function( elem ) ( return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0; ); ));

इसके साथ ही,

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

इन तत्वों में से तीन का चयन करेगा:

 john John hey hey JOHN hey hey 

पाब्लो फोर्ट्स के माध्यम से डेमो।