$(document).ready(function() { $nav = $('.nav'); $toggleCollapse = $('.toggle-collapse'); /**click event on toggle menu */ $toggleCollapse.click(function() { $nav.toggleClass(collapse); }); }); code example
Example: jquery toggle class
$( "#foo" ).toggleClass( 'className', addOrRemoveOptional );