I am selecting a radio button from a set of radio buttons based on its value attribute. Everything is fine except if value attribute contains a single quotes. I am encoding it before binding the value so it cause no issue in html markup. But jquery is not working while trying to make the selection. The issue is only in IE7.
Radio button markup:
<input type='radio' name='radName' value='value1'>
<input type='radio' name='radName' value='value2'>
<input type='radio' name='radName' value='value3'>
Jquery to select the radio button:
myVal = funToGetSomeValue();
if ($('input[name=radName][value="' + myVal + '"]').length) {
$('input[name=radName][value="' + myVal + '"]').prop('checked', true);
}
Encode special characters in code behind(C#) using HtmlEncode:
System.Web.HttpUtility.HtmlEncode(EmailStr);
Everything is good here except when myVal contains value with single quotes.
Any thoughts?