SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2004
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool see if css class exists...

    hi...
    is it possible to know by javascript if a certain css class is in the html?

    would greatly apreciate help on this...

  2. #2
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Why is this in the general chat forum?

    You can check what class is assigned to a particular element through Javascript, even change it but I don't think it can tell what classes exist if they aren't used.
    Wayne Luke
    ------------


  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Do you want to know if a class is available in the stylesheet, or if an HTML element has a certain class applied to it?

    Off Topic:

    Oh yeah, and moved to the Javascript forum.

  4. #4
    SitePoint Zealot
    Join Date
    Mar 2004
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi again...

    i post the question on general forum, and pardon my ignorance, cause i don't know how to put it on main discussion... must be a very simple thing to do and i've looked around but i just can't find it, so you can help me out on this too...

    my doubt is...
    a have a onLoad java function
    i want to know on the page load if i "called" somewhere in the page for a certain existing class ... the class exists... just want to know if the page has a reference to it or not

    thanks...

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Try running this function here. Something like this should work to start off the function:
    HTML Code:
    <body onload="getElementsByClassName('myClass');">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •