I want a DIV to fade out, update its content, then fade back in as tidy as possible.
Current Way (http://jsfiddle.net/19czxx9r/2/)
$(".my_div").off().on('click', function(){
$(".my_div").fadeOut(function(){
$(".my_div").text("i was clicked");
$(".my_div").fadeIn();
});
});
Ideal Way (http://jsfiddle.net/19czxx9r/1/)
$(".my_div").off().on('click', function(){
$(".my_div").fadeOut();
$(".my_div").text("i was clicked");
$(".my_div").fadeIn();
});
I'd like to avoid the current way, which works, because I'll end up needing to nest tens of functions for my project.
Is there a way to efficiently queue the commands in the ideal way so they run after each one finishes?
Thanks