I'm having trouble implementing this. From other questions I have the following snippet:
jQuery.expr[":"].Contains = jQuery.expr.createPseudo(function(arg) {
return function( elem ) {
return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
But I get the error: TypeError: jQuery.expr.createPseudo is not a function
Any ideas? In addition, where should this snippet be placed? Document ready?
Thanks,
Dave
Don't use createPseudo
:
jQuery.expr[":"].Contains = function(obj,index,meta) {
return jQuery(obj).text().toUpperCase().indexOf(meta[3].toUpperCase()) >= 0;
};
From here.
It doesn't matter where you put this - you're just defining a function, not accessing the DOM - so it doesn't have to be inside document.ready
. Just make sure you load jQuery before you define this filter and define it before you use it. Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With