I am trying to select an input in my dom and I know it can be done like so:
$("input[value='foo']") ...but lets say we have a variable x = 'foo'. How can I use that jquery selector with the variable. I tried:
query = "input[value=" + x + "]" but that results in "input[value=foo]" which is not the same.
How can I insert my variable into this jQuery selector?
$("input[value='" + x + "']");- Possible duplicate of How to use javascript variables in jquery selectors