I use jQuery toggleClass like this:
$('.demo').toggleClass('classa classb');
Now how can I toggle this to all elements that have class demo except for links?
demo
Use the not selector:
$( ".demo" ).not( "a" ).toggleClass( "classa classb" );