I'm trying to achieve a simple feedback on a button press to fade out the button quickly, change its class and content, fade in then do the reverse back to its original state.
This is the code I thought would work fairly simply.
$('#event1-btn-451').fadeOut(200).toggleClass('btn-primary btn-success').html('Success!').fadeIn(200);
$('#event1-btn-451').delay(2000).fadeOut(200).toggleClass('btn-success btn-primary').html('Add Event').fadeIn(200);
The first line by itself works fine but if I include the second line all it does it fadeout, fadein the same 'Add Event' button with the original color, then do exactly the same thing again after the 2s delay.
First time actually posting here though of course like many I've used this for so many answers already!