My icon functions as an open/close button. When opened, it turns red and rotates 45 degrees. The issue arises when trying to close it. Changing the div class causes the icon to disappear while in its active state. Below is the jQuery code I am using:
$(".fa-plus").click(function() {
$(".form").removeAttr("style");
$('.fa-plus').css('-webkit-transform', 'rotate(45deg)');
$('.fa-plus').css('-webkit-transition', '0.25s');
$('.fa-plus').css('color', '#FF0000');
$(".fa-plus").attr("id", "test");
});
This function opens the icon and adds an ID called "test". Clicking on the icon with ID "test" does not display an alert, only clicking on the "+" symbol does.
$("#test").click(function() {
alert('test');
});
Here's a demo. I only want the alert to appear when clicking on the red X symbol.