Jump to content

javascript and css classes


Goose

Recommended Posts

Basically I want a javascript to change a property in a css class. I know the class name and I have the property and the value I need to change the property to. Is there a way that javascript can edit the class and then all the objects that hold that class refresh so that they reflect the new values?

Thanks.

Edit: If anyone can just post an example snippet of code, that would be awesome. The class name that I want to edit is named "trow" and the property I want to edit is "display" and I want to set it to "none".
Link to comment
https://forums.phpfreaks.com/topic/4238-javascript-and-css-classes/
Share on other sites

i think all you have to do is have two different classes... one with display:none, one with display:block, and have everything you need to change have the same id. then use document.getElementById(yourid).className = 'off' ... or whatever. try it. seems correct.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.