I have a jquery selector that looks like:
var val = "John's cars";
$('#subject input[value="'+val+'"]')
This works just fine in Firefox, Chrome, Internet Explorer 8, but not in IE 6 or IE7. The problem is the ' in the text search for. Someone has any idea how to work around this problem except to loop through all inputs in question and do a string compare?
Try this:
Try escaping the
'
with a backslashfrom jQuery
EDIT:
since the value is in a string literal, it needs to be double-escaped. So this works
Thanks to bobince for pointing it out.
I bet it's the apostrophe in the search value - try escaping it using