Well, I'm more of a PHP person, and my JS skills are close to anyone when it comes to any JS other than simple design-related operations, so excuse me if I ask the obvious.
the following operations would be easy in PHP (and may also be in JS), but I'm fighting the unfamiliar syntax here ...)
This is a kind of input confirmation
var ar = ["BRS201103-0783-CT-S", "MAGIC WORD", "magic", "Words", "Magic-Word"]; jQuery(document).ready(function() { jQuery("form#searchreport").submit(function() { if (jQuery.inArray(jQuery("input:first").val(), ar) != -1){ jQuery("#contentresults").delay(800).show("slow"); return false; }
This question has two parts.
- 1 - how can I let an array be case insensitive?
eg. - BRS201103-0783-CT-S will give the same result as BRS201103-0783-CT-S AND BRS201103-0783-CT-S or MAGIC magic Magic MaGIc
Basically, I need something like ignoreCase () for the array, but I could not find a link to jQuery and JS ...
I tried toLowerCase() - but it does not work on the array (ittirating?), And also, will it allow a mixed case?
- 2 - How can I make a function recognize only parts or combinations of elements?
eg. - if one type is only "word" , I would like it to go like "words" , and also, if someone types "some word" , it should pass (containing the word)
Obmerk kronen
source share