The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS css id and onClick

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #40838


    I have a row of 4 blocks, set up with php all have same id called “Option”, and have a onClick function.
    When you click it the number shows up which one you clicked… but only the first one ever changes

    here is the link – do a view source to see code.

    so, any help on how I make the actual ‘block’ you click change colour and not just the first one all the time….

    I know this can be done if I have id=”option1″ id=”option2″ etc… but I am trying to avoid this and have just
    one id, but somehow change the colour of the one that is selected.

    thanks so much for reading!



    ID’s are only to be used once…which is where you are probably going wrong.

    Try creating a class that will do the same thing and then add that using JS.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.