Click to See Complete Forum and Search --> : need help badly..for the <select> tag
nebchill26
05-28-2008, 02:47 AM
is there an ALT tag like in the <IMG> for <SELECT> ????
this is what i want to do but i can't
<select>
<option alt="Test 1"> A very very long text</option>
<option alt="Test 2"> Another very very long text</option>
<option alt="Test 3"> The longest text</option>
</select>
Centauri
05-28-2008, 06:17 AM
An "alt" tag is used to display text when the image is not available. Such a thing for a select would be pointless, as if the select could not be displayed there would be no point replacing it with text..
felgall
05-28-2008, 04:36 PM
There is no image displayed by that select tag. If there were images displayed (eg. inside the options) then of course you can add the alt tag to the images to define the alternate text to be displayed when the images are unable to be loaded. There is never a need to put an alt attribute in any tag apart from an <img> since without an <img> tag there is no image to need alternate text. For <object>s the alternate text for when the object can't display goes between the <object> and </object> tags. Apart from images and objects there is nothing that can be placed in a web page that can be disabled and therefore would need alternate text.
Perhaps you are looking for an alternative to the <img title="tooltip text"> that works for other tags. The same title attribute can be added to most other tags to display a tooltip just the same as it can for the <img> tag. So you can have <select title="tooltip">
nebchill26
05-28-2008, 08:04 PM
tnx for the help guys, the title="tag" was exactly the one i was looking for,my only problem now is that when i tried it, it only works on Firefox and not on IE.Is there a way around it?tnx again
here's a sample
<select name="">
<option value="the_value_of_titletag_1" title="short text_1"> A very long text that is longer than the webpage number 1</option>
<option value="the_value_of_titletag_2" title="short text_2"> A very long text that is longer than the webpage number 2</option>
<option value="the_value_of_titletag_3" title="short text_3"> A very long text that is longer than the webpage number 3</option>
</select>
toicontien
05-29-2008, 03:16 PM
Nope. Internet Explorer doesn't support the title attribute for the OPTION tag. You could use a CSS hack maybe:
<select style="width: 100px;">