This has got to be simple. Why am I getting the error missing ) after argument list
on this jQuery? All the (
and )
are closed. I tried escaping the quotes, too.
$(".state-button").on("click", function(e) {
if ($(".record.state:contains("AR")").length > 0) { //Error on this line
$(".record").toggleClass("display-block");
e.preventDefault();
});
}
CodePudding user response:
This is proper
$(".state-button").on("click", function(e) {
if ($(".record.state:contains('AR')").length > 0) {
$(".record").toggleClass("display-block");
e.preventDefault();
}
}); <-- here
CodePudding user response:
Some syntax error. try this
$(".state-button").on("click", function(e) {
if ($(".record.state:contains('AR')").length > 0) { // here changed "AR" -> 'AR'
$(".record").toggleClass("display-block");
e.preventDefault();
};
}) // ')' should be added here