My issue involves a button with the text: Add to bag and CSS hover properties of background-color:#A9885D; color:#fff;
Using jQuery, I want the text to change to Added when the button is clicked, with a green background color. Then, after 5 seconds, it should revert back to its original text.
The challenge I'm facing is that only the text Added reverts back to Add to bag after 5 seconds, not the hover background-color and text color. How can I also revert the hover styles along with the text?
jQuery( document ).ajaxComplete(function() {
var element = jQuery("a.button.product_type_simple.add_to_cart_button.ajax_add_to_cart.added");
element.text("ADDED");
setTimeout(function() {
element.text("ADD TO BAG");
element.css('background-color', '#F0EFEB');
element.css('color', '#A9885D');
}, 5 * 1000);
I attempted element.css.hover('background-color', '#A9885D'); with no success. I also tried using .mouseover function but couldn't make it work, as I am still new to jQuery :)