BlueDogRanch
BlueDogRanch

Reputation: 574

jQuery missing ) after argument list, but the ( ) and closed and escaping quotes doesn't work

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();
    });
}

Upvotes: 0

Views: 36

Answers (1)

Eric
Eric

Reputation: 10646

This is proper

 $(".state-button").on("click", function(e) {
      if ($(".record.state:contains('AR')").length > 0) {
           $(".record").toggleClass("display-block");
           e.preventDefault();
      }
 }); <-- here

Upvotes: 1

Related Questions