I am trying to query for a button which has a predefined value.
If the query value is as follows, it works fine:
_v = "Button1";
But as soon as the query value is:
_v = "Button 1"; // with spaces
_v = "Button / Button / Button"; // or with slashes
the following query fails:
$('.club[value=' + _v + ']').addClass('active');
and i get the following error:
Uncaught Syntax error, unrecognized expression: [value=Button 1]
How do I have to change the query so that it doesn’t fail anymore?
You need to wrap the value with double quotes