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
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.