Jump to content

jQuery - disable event


kirill578

Recommended Posts

You're going about this the wrong way--address the final outcome, not the method to do it.

What you said in your original post is essentially that you want to be able to revert the background color to its original color.

 

The easiest and most direct way to do this is to assign a class to the dom element that you want to attach the color change to.  That's just as simple as using .addclass() and .removeclass() in jQuery and styling the classes appropriately. 

 

Technically to ensure it's good in all browsers now and in the future, you'd want to assign a class in the HTML, then when you want to change the color, add the new class while removing the old one.  When you want to change it back (when the link is clicked in your example) just removed the added class and add back the original one.  Ensure both classes are styled appropriately in your css file and you're good to go.

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.