Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jQuery Toggle Class on Click
<a href="#" class="toggle-class">Toggle Class</a>
<style>
.no-bg {
background-image: none;
}
</style>
<script>
jQuery(document).ready(function($) {
$(".toggle-class").click(function () {
$(".target-class").toggleClass('no-bg');
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.