I am new to jQuery and I am trying a simple program. In this program what I am trying to achieve is that when I will click the div text then first line will fadeout then it will change background colour and then it will fade in so overall it will give effect of changing colour slowly, but what happening here is when I click the text the line changes colour suddenly then it fades out and then it fades in. So I was wondering if there is a way to make colour changing code execute after execution of fadeout.
my program:
$(document).ready(function(){
$("#firstDiv").click(function(){
// $(this).fadeOut(1000);
$(this).fadeOut(1000);
$(this).css("background-color", "aqua");
$(this).fadeIn(1000);
});
});
</script>
</head>
<body>
<div id="firstDiv" style="background-color: yellowgreen">
Click Me
</div>
</body>