I'm a bit of a newbie working on a web application. Currently building one JSP page with a select box that selects a value upon page load based upon a value inserted through EL. This is done using the following JQuery function:
$('.interestBox').each(function(){
if ($(this).val() ===('${personalFile.interest}')) {
$(this).attr({selected: 'selected'});
} else {
$(this).removeAttr('selected');
}
});
This was working fine... until somebody added a field of interest "Don't Know" and another one "Mr. "T"" (The 'T' is with quotation marks - can't just change from ' to ''). This is all data that is pulled from a DB so I don't have much control. But here's what the first line in the function will look like for these two samples:
if ($(this).val() ===('Don't Know')) {
If I change from single quote to double quote, it will not solve the problem. See below:
if ($(this).val() ===("Mr. "T"")) {
Now, the JS script doesn't work. Anyone have any idea how to deal with this? Thanks.