Click on #buttonID
to add the class newClass
to another element .targetElementClass
.
This script includes a transition of 250ms.
Click on #buttonID
to add the class newClass
to another element .targetElementClass
.
This script includes a transition of 250ms.
$(document).ready(function() {
$('#buttonID').click(function() {
$('.targetElementClass').addClass('newClass',250); // Fade in the effect over 250ms
})
});
Paste this snippet into a JavaScript file that is loaded by your page, or you can put it between <script> </script>
tags in the footer.
jQuery is required.