Hi, This is my first post on the forum, i am plotting some nodes on a map, from an excel sheet, on the page there are some check boxes, selecting which will plot the respective entries on the map, e.g. when i select the checkbox "VIP Sites" then only the VIP entries should be displayed, in order to specify whether the entry is VIP or Not there are multiple comparison for example i am using
the problem is that it only displays the entries contained in city1 i.e. because matches at first , i want to display all other entries which are matching with city2, city3 and city4, PLease guide.
HI All,
thanks for the replies, both solutions worked great, one issue is that some times a city name is written in Uppercase like CITY1, some times it is written as City1 and some times city1, so how can i matched it with all without providing the values as hard coded, i.e. it should check only the spelling,
Use the method toLowerCase() for all strings or build a regular expression to make a test
Code:
var reg=/city1|city2|city3|city4/i;// with a i for ignore case
// Then use
else if (plotOptChbox[4].checked == true && reg.test(citiesmarkers[i].get('City'))) {/...
}
NB : The eleven following «metacharacters» must be preceded by a back slash :
the opening square bracket [, the backslash \, the caret ^, the dollar sign $, the period or dot ., the vertical bar or pipe symbol |, the question mark ?, the asterisk or star *, the plus sign +, the opening round bracket (, and the closing round bracket ).
In the absence of these characters the regular expression can be constructed with such a simple
var reg=new RegExp("city1|city2|city3|city4","i");
Bookmarks