I would like to remove the years 2014 & 2015 from both the check in and check out using Regex-
I tried using containsRegex but I guess I'm doing something wrong:
$("option:containsRegex(/^((2014)|(2015))$/)").remove();
Here's the example code:
<select name="check_in" class="required">
<option value="">Year</option>
<option value="2013" selected="selected">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
</select>
<select name="check_out" class="required">
<option value="">Year</option>
<option value="2013" selected="selected">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
</select>
I can do it like that:
$('option:contains("2014")').remove();
$('option:contains("2015")').remove();
But I want to be able to do it using regex becuase the real file is more complicated than that.. Here's the fiddle: http://jsfiddle.net/PJjGb/1/ so you can try.
To sum it up I want to remove certain 'option's of the 'select' element. and to be able to choose which option by using regex- In this example removing option '2014' and '2015' using regex from both check in and check out. Thank you. (Here I did that without regex: http://jsfiddle.net/PJjGb/)