0

i want to apply two color property on an element with Jquery chaining method but only one is working

$("#p1").css("color", "red").slideUp(2000).slideDown(2000).css("color","green");

1 Answer 1

1

Set css property after completing the slideDown , for that you can use callback function

$("#p1").css("color", "red").slideUp(2000).slideDown(2000,function(){
  $(this).css("color","green");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="p1">hiiiiii</div>

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.