toogle button in particular class using javascript code example Example: jquery toggle class $( "#foo" ).toggleClass( 'className', addOrRemoveOptional );