trowley Posted January 11, 2012 Report Share Posted January 11, 2012 Hi, I am trying to create a case insensitive search. This works in FF but nowhere else(Safari, Chrome, IE): var searchTerm = this.value;//from input box var string1 = point.name;//the string to search var matchTerm = string1.search(searchTerm, "i"); if(matchTerm != -1){ //code goes here }); The search works in all browsers, it is just case sensitive everywhere except FF Thanks! Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 11, 2012 Report Share Posted January 11, 2012 You could just use the toLowerCase() method on both strings, ensuring that both strings will be compared without concern for upper or lowercase characters. Quote Link to comment Share on other sites More sharing options...
trowley Posted January 12, 2012 Author Report Share Posted January 12, 2012 Thanks that worked! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.