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
}
});