Forums

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

Home Forums CSS ? re: Conditional CSS (not what you think)

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37924
    pixelologist
    Member

    Is there a way to apply CSS classes conditionally….based not on browser but on whether a certain radio button was selected elsewhere on the page?

    For example, let’s say I’m constructing a registration form and part of that form requires the user to select which address – home or business – they’d like to be their preferred address for correspondence. And, based on their selection, either the address fields in the Home section or the address fields in the Business section would become “required” (bolded and asterisked)…while the others would remain optional.

    Is there a way to do this using only CSS?

    #102311
    WJvanTilburg
    Member

    Could be something in the trend

    .checkbox::checked + .inputBusiness {
    font-weight: bold;
    }

    This requires the input to be directly after the checkbox.

    JQuery is the only solution that will ensure cross browser support though.. so you sure you want a css only solution?

    Regards,

    WJ

    #102314
    pixelologist
    Member

    Thanks for that fast(!) response :)

    Well, I’ve really only just started getting to know css….but I’m a complete stranger to JQuery. So I would have no idea how to even begin….

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