<!DOCTYPE html> <html> <head> <meta charset = "utf-8"> <title>jQuery UI addClass Example</title> <link href = "https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel = "stylesheet"> <script src = "https://code.jquery.com/jquery-1.10.2.js"></script> <script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <style> .elemClass { width: 200px; height: 50px; background-color: #b9cd6d; } .myClass { font-size: 40px; background-color: #ccc; color: white; } </style> <script type = "text/javascript"> $(document).ready(function() { $('#button-1').click(function() { $('#animTarget').animate({ backgroundColor: "black", color: "white" }) }) }); </script> </head> <body> <div id = animTarget class = "elemClass"> Hello! </div> <button id = "button-1">Click Me</button> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more