title attribute in option tags

Discussion in 'HTML & Website Design' started by Jamie18, Jan 16, 2009.

  1. #1
    I'm trying to create a select box where the individual options have titles displayed when the cursor is over them.. the following works with firefox but not IE

    <select>
      <option title="volvo" value="volvo">Volvo</option>
      <option title="saab" value="saab">Saab</option>
      <option title="mercedes" value="mercedes">Merc...</option>
      <option title="audi" value="audi">Audi</option>
    </select>
    Code (markup):
    So when you roll over volvo i want the title description to come up and simply say volvo

    the reason for this is that i have some options that have to be trimmed to fit in the select box.. so i want the title to be displayed as the non-trimmed text..

    in IE the above style is not recognized and no description is shown.. does anyone know a good way to do it? i tried wrapping the option text with spans and putting the title attribute in it.. but no luck
    i.e. <option value="mercedes"><span title="Mercedes">Merc...</span></option>
     
    Jamie18, Jan 16, 2009 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    Are you talking about IE6? IE7 and the modern browsers all work as expected. IE6 does not support the title attribute on option.

    The option element may contain only #PCDATA, character data, no other elements.

    cheers,

    gary
     
    kk5st, Jan 16, 2009 IP