user1781710
user1781710

Reputation:

jQuery addClass method not working in FF 34.0.5

I have some code like this:

$(document).on("taphold", ".card-cart", function(event) {
     if ($(this).hasClass("delete-mode-on")) {
         $(this).toggleClass("delete-mode-on");
         $(this).find(".card-delete-area").addClass("hidden");
     }
     else {
         $(this).siblings(".card-cart").removeClass("delete-mode-on").find(".card-delete-area").addClass("hidden");
         $(this).toggleClass("delete-mode-on");
         $(this).find(".card-delete-area").removeClass("hidden"); 
     }
 });

When I test the code in FF it's not adding the class, but it works find in Safari, IE 11 and Chrome.

Any ideas?

Upvotes: 0

Views: 102

Answers (2)

user1781710
user1781710

Reputation:

After some additional debugging I determined that some corruptly parsed JSON was saved in my <div> as HTML 5 data tags created by a for loop. I removed the corrupted data and that resolved the issue.`

Upvotes: 1

Max
Max

Reputation: 336

why not use

$(selector).hide();

are you sure, that your selector is selecting the right node? maybe try your selector with

$(yourselector).css({border: '1px solid red'});

and see if it works

Upvotes: 0

Related Questions