callback in function removeClass jQuery

Asked

Viewed 132 times

0

I’m trying to use the callback in function removeClass but it’s not working, someone knows what’s wrong?

I need to execute the removeAttr only after the removeClass.

    $(".context_menu_pai").removeClass('open' , function() {
        $(".context_menu_pai").removeAttr("style");
    });
  • 1

    I was also answering but the question was deleted, and only now I saw that it was undone. I think you refer to the iterator function that the method has. This function is not an asynchronous callback, but rather to iterate the classes. And in this case the method only accepts this function, as the documentation that the bfavaretto pointed out.

1 answer

2


That callback?! This method does not accept callback!

Since there are no asynchronous operations involved, simply chain the calls, so:

$(".context_menu_pai").removeClass('open').removeAttr("style");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.