What's new
HTML Forums | An HTML and CSS Coding Community

Welcome to HTMLForums; home of web development discussion! Please sign in or register your free account to get involved. Once registered you will be able to connect with other members, send and receive private messages, reply to topics and create your very own. Our registration process is hassle-free and takes no time at all!

OnClick to Alter Class Variable


New member
I found this lovely toggle script to alter an elemants class:

$( "button" ).on( "click", function() {
$( "p" ).toggle();
} );

the result is all <p> disappearing, which i use throughout my design.

and lets say <p> has this styling :
p {font-size:2em; color:red; float:right;}

is there a way to alter JUST the font color without the entire <p> vannishing?

Ive tried ( "p.color" ), ( "p/color" ), ( "p:color" ), ( "p,color" )

any help would be appreciated