I have a select element, and I want to detect which option the user is hovering over. I am using the code here that ShankarSangoli has wrote but it is not working. I have tested in Chrome.
$("select").hover(function (e)
{
var $target = $(e.target);
if($target.is('option')){
alert($target.attr("id"));//Will alert id if it has id attribute
alert($target.text());//Will alert the text of the option
alert($target.val());//Will alert the value of the option
}
});
The functionality you’re trying to achieve is not availiable in Chrome nor IE yet.
This is pointed out in the question you’re currently refering to.
As @purgatory 101 pointed out, a clever use of the combobox will allow you to “hook in” additional jquery which might allow you to alert(); on hover.
Just working of the source to combobox this would be a pointer in the right direction: