Making jQuery selector/contains case insensitive
Posted by mkhairul - November 26, 2008 at 03:11:49 pm -Categories: Troubleshoot, blog, code
Just another stuff from work. There’s huge list to select people to be put into groups in the LMS. I added a javascript function for the user to type in a name and it will search and select a user in the list box.
I use Selector/contains for this but the problem is, it is case sensitive. That’s gonna be a problem to type in the exact case from the list. Here’s a snippet to extend the selector.
jQuery.extend(
jQuery.expr[':'], {
contains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
});
Took the snippet from StackOverflow, but it has a typo.
No Comments yet »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.
