Make an element in a multiple list unselectable???

Discussion in 'HTML' started by Nick, Jul 21, 2003.

  1. Nick

    Nick Guest

    Is it possible through css to make an element in a multiple list menu
    unselectable. Im organizing my list by using titles...

    +-------------+
    | CATEGORY 1 |
    | option 1 |
    | option 2 |
    | option 3 |
    | CATEGORY 2 |
    | option 1 |
    | option 2 |
    | option 3 |
    | CATEGORY 3 |
    | option 1 |
    | option 2 |
    | option 3 |
    +-------------+

    Id like to make the CATEGORIES unselectable. Thanks! -Nick
    Nick, Jul 21, 2003
    #1
    1. Advertising

  2. Nick

    Steve Pugh Guest

    (Nick) wrote:

    >Is it possible through css to make an element in a multiple list menu
    >unselectable.


    I'm presuming that you mean a <select> element rather than just an
    ordinary list of links.

    Why with CSS? CSS is for presentation. Making something unselectable
    sounds like functionality to me.

    The disabled attribute exists for the option element. But Windows IE
    doesn't support it. :-(

    >Im organizing my list by using titles...
    >
    > +-------------+
    > | CATEGORY 1 |
    > | option 1 |
    > | option 2 |
    > | option 3 |
    > | CATEGORY 2 |
    > | option 1 |
    > | option 2 |
    > | option 3 |
    > | CATEGORY 3 |
    > | option 1 |
    > | option 2 |
    > | option 3 |
    > +-------------+
    >
    >Id like to make the CATEGORIES unselectable. Thanks! -Nick


    Looks like you want the optgroup element.

    <select name="foo">
    <optgroup label="CATEGORY 1">
    <option>option 1</option>
    <option>option 2</option>
    <option>option 3</option>
    </optgroup>
    <optgroup label="CATEGORY 2">
    <option>option 1</option>
    <option>option 2</option>
    <option>option 3</option>
    </optgroup>
    <optgroup label="CATEGORY 3">
    <option>option 1</option>
    <option>option 2</option>
    <option>option 3</option>
    </optgroup>
    </select>

    Works in most modern browsers. In older browsers the options are
    presented as normal but the labels aren't presented at all.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Jul 21, 2003
    #2
    1. Advertising

  3. Steve Pugh <> wrote:

    > Looks like you want the optgroup element.


    Maybe. But in the absence of a URL to demonstrate what he is really
    doing, my verdict is that he wants to create an expensive plastic
    simulation of a hierarchic list of links.

    > Works in most modern browsers. In older browsers the options are
    > presented as normal but the labels aren't presented at all.


    OK, let's say that it works in 95 % of browsing situations (as far as
    _rendering_ is considered). The actual figure is probably somewhat
    smaller. Anyway, even 5 % of possible users is a huge number. Is it
    acceptable that the fallback has no label texts? I would answer:
    yes, _if_ the labels are just for grouping options that are
    understandable on their own. But it would be disastrous if e.g. some
    options were identical, relying on the category labels for
    disambiguation.

    It's possible to create a hierarchic menu inside a form without using
    optgroup, namely by using grouped radio buttons, see
    http://www.cs.tut.fi/~jkorpela/forms/choices.html#optgroup

    Massive crossposting triggered the usual "set Followup-To at random"
    function. In future, the OP should spend some time in analyzing which
    is _the group_ for his question.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Jul 22, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. oaksong

    unselectable datacombo

    oaksong, Nov 1, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    323
    oaksong
    Nov 1, 2005
  2. oaksong

    unselectable datacombo

    oaksong, Nov 1, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    508
    oaksong
    Nov 1, 2005
  3. na
    Replies:
    5
    Views:
    425
    Mark Rae
    Oct 15, 2006
  4. john
    Replies:
    2
    Views:
    115
  5. Garg

    how to make a form unselectable?

    Garg, Jun 21, 2007, in forum: Javascript
    Replies:
    1
    Views:
    108
    kaaposc
    Jun 21, 2007
Loading...

Share This Page