2

I want to call a function after css() jquery. I want something like this :

$("p").css({"color":"red"}).function({
     $("div").hide();
});
5
  • 1
    .css() is synchronous... Commented Apr 22, 2015 at 9:16
  • what are you really trying to do Commented Apr 22, 2015 at 9:17
  • @RajaprabhuAravindasamy did you mean that is impossible ?? Commented Apr 22, 2015 at 9:18
  • Its hard to answer without knowing your exact requirement, your code and this $("p").css({"color":"red"}); $("div").hide(); are pretty much same.. But i don't think .css() have a callback. Commented Apr 22, 2015 at 9:20
  • I check this answer and that work. stackoverflow.com/a/29792910/3106610 Commented Apr 22, 2015 at 9:24

1 Answer 1

7

You can use queue() function:

$("p").css({"color":"red"}).queue(function() {
   $("div").hide();
   $(this).dequeue();
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.