3

I've searched a quite a bit but haven't found a soulution yet.

It seems that chrome doesn't recognize the "alt" or "title" attribute inside an option tag, the problem can be reproduced on Chrome for windows (43.0.25357.130m) This doesn't seems to affect IE nor firefox. Is there any alternative way to show a tooltip or am i doing something wrong?

fiddle: http://jsfiddle.net/ftmv4rhx/

<select >
<option alt="Testing" title="Testing">lelel</option>
    <option alt="Testing" title="Tesfdting">le5lel</option>
    <option alt="Tesdting" title="Teasdfsting">le4lel</option>
    <option alt="Tedfsting" title="Teasdsting">le23lel</option>
    <option alt="Tesgating" title="Tesdfsting">lel1el</option>
</select>

I've already seen How can I display a tooltip on an HTML "option" tag?, but and none of those answers worked for me, perhaps a new update in chrome corrupts the title attribute inside the option tag. (Btw it does work on linux chromium 38.0.2125.101)

Community
  • 1
  • 1
Juanma
  • 31
  • 4
  • possible duplicate of [How can I display a tooltip on an HTML "option" tag?](http://stackoverflow.com/questions/3249591/how-can-i-display-a-tooltip-on-an-html-option-tag) – Dave Jun 29 '15 at 20:03
  • 1
    @dave Already saw that post, and none of those answers worked for me, perhaps a new update in chrome corrupts the title attribute inside the option tag. (Btw it does work on linux chromium 38.0.2125.101) – Juanma Jun 29 '15 at 20:12
  • 1
    I suggest you mention that post in your question and state why your question is different. – Ely Jun 29 '15 at 20:21
  • https://bugs.chromium.org/p/chromium/issues/detail?id=491223 – bishop Jun 08 '18 at 13:42

1 Answers1

-1

You can access an options alt or title element like this:

$('select').on('change',function(){
    console.log($(this).val());
    console.log($(':selected',this).attr('alt'));
    console.log($(':selected',this).attr('title'));
});

console.log($('select option[alt="Testing"]').val());
console.log($('select option[title="Tesdfsting"]').val());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<select >
<option alt="Testing" title="Testing">lelel</option>
    <option alt="Testing" title="Tesfdting" id='test'>le5lel</option>
    <option alt="Tesdting" title="Teasdfsting">le4lel</option>
    <option alt="Tedfsting" title="Teasdsting">le23lel</option>
    <option alt="Tesgating" title="Tesdfsting">lel1el</option>
</select>
depperm
  • 10,606
  • 4
  • 43
  • 67
  • @Juanma Why does this not work? Using Chrome all these operations work. Why do you think Chrome doesn't recognize the title and alt elements? – depperm Jun 29 '15 at 21:57
  • This does work, however it doesn't has to do with the original question, **show a tooltip inside option tag**. It seems chrome doesn't show it at all. – Juanma Jun 30 '15 at 14:03