toggle css jquery code example
Example 1: toggle class javascript and jquery
$('.click-class').click(function() {
$('.class-toggle').toggle();
$('.class-toggle').toggleClass('add-class');
})
Example 2: toggle text jquery
$("button").click(function(){
$(this).text($(this).text() == 'Show' ? 'Close' : 'Show');
});
Example 3: jquert toggleClass condition
// add class [class-name] if condition is true
// or else remove it
$('#foo-bar').toggleClass('class-name', condition)
Example 4: toggle class jquery
toggleClass