jQuery - Query for textbox by value? (value contains quotation marks)

suicider

New Member
I have a string in JavaScript that contains a quote mark - for example, \[code\]Don't click this checkbox\[/code\] or \[code\]He said "hi"\[/code\]. I am trying to find a checkbox that has the exact same value.For my first example, I have the HTML:\[code\]<input type="checkbox" value="http://stackoverflow.com/questions/15466624/Don/'t click this checkbox">\[/code\]And my variable q has the string \[code\]Don't click this checkbox\[/code\] in it. To try and query for this checkbox, I have the following code. Where am I going wrong?\[code\]q = q.replace("'", "\'").replace("\"", "\\"");var $checkbox = $("input:checkbox[value='" + q + "']");\[/code\]
 
Back
Top