JQuery selector problem in Internet Explorer?

Try this: var val = "John's cars"; $('#subject input'). Filter(function() { return this. Value == val; }).

Works like a charm, thanks – Ulf Lindback Oct 7 '09 at 19:30.

Try escaping the ' with a backslash var val = "John\'s cars"; $('#subject inputvalue="'+val+'"') from jQuery Special characters in selectors If you wish to use any of the meta-characters described above as a literal part of a name, you must escape the character with a backslash (). Since Javascript uses the backslash for escape sequences in string literals, you must use two backslashes (\) in string literals so that a single backslash will be put into the string. Example: "#foo\\:bar" "#foo\\bar\\" "#foo\\.

Bar" The full list of characters that need to be escaped: #;&,. +*~':"! ^$()=>|/ EDIT: since the value is in a string literal, it needs to be double-escaped.So this works var val = "John\\'s cars"; $('#subject inputvalue="'+val+'"') Thanks to bobince for pointing it out.

– Russ Cam Oct 7 '09 at 19:34 I'm using jQuery 1.3.2 – Ulf Lindback Oct 7 '09 at 19:37 Hmmm... strange. It doesn't seem to work in Firefox 3.5 either. Looks like using filter is the best way – Russ Cam Oct 7 '09 at 19:45 Your \' is in a JavaScript string literal, where it means '.

You need another level of escaping: "John\\'s cars" to get the real backslash character into the selector string. Dear lord, StackOverflow's own handling of backslashes is broken... – bobince Oct 7 '09 at 20:44.

I bet it's the apostrophe in the search value - try escaping it using "John\'s cars.

Using filter() would loop from the loop that jQuery already creates ...

In my case, performance doesn't really matter. Do you have another solution that would perform better? – Ulf Lindback Jul 22 '10 at 19:48.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions