js change toggle class element js code example Example: jquery toggle class $( "#foo" ).toggleClass( 'className', addOrRemoveOptional );