[jQuery] Finding/selecting items identified by an attribute whose value contains quote characters

[jQuery] Finding/selecting items identified by an attribute whose value contains quote characters


I am writing a test harness for a web app using jquery. When recording
a test, I add handlers for user interaction events (e.g. click on an A
tag), and record details of the tag clicked. When playing back, I need
to find the tag (so I can emulate a click on it).
The A tags do not have id elements - the only unique way to identify
then is to use the href.
However, I have hrefs containing quote characters [typical hrefs
include "javascript:Go('fred')" and even "javascript:Go(\"jimmy's
\")"].
How do I construct a jquery selector to match these?
My first attempt (before I noticed the presence of the quotes) was
$("A[href='" + href + "']")
Interestingly, this hung the browser completely for many minutes!













    • Topic Participants

    • nikki