Title tag inside option (chrome)

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

It seems that chrome does not recognize the "alt" or "title" attribute inside the parameter tag, the problem can be reproduced in Chrome for windows (43.0.25357.130m) This does not affect IE and Firefox. Is there an alternative way to show the tooltip or am I doing something wrong?

script: 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 have already seen How to display tooltip on HTML option "tag? But none of these answers worked for me, maybe new update in chrome mangles the title attribute inside the parameter tag. (Btw it works on linux chromium 38.0.2125.101)

+3


source to share


1 answer


You can access alt or title elements 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>
      

Run codeHide result


-1


source







All Articles