JQuery selector value escaping
- by user53794
I have a dropdown list that contains a series of options:
<select id=SomeDropdown>
<option value="a'b]<p>">a'b]<p></option>
<option value="easy">easy</option>
<select>
Notice that the option value/text contains some nasty stuff:
single quotes
closing square bracket
escaped html
I need to remove the a'b]<p option but I'm having no luck writing the selector. Neither:
$("#SomeDropdown >option[value='a''b]<p>']");
or
$("#SomeDropdown >option[value='a\'b]<p>']");
are returning the option.
What is the correct way to escape values when using the "value=" selector?