
Untitled
By: a guest on
May 2nd, 2012 | syntax:
None | size: 0.54 KB | hits: 275 | expires: Never
jQuery-Select list option hover
$("select > option").hover(function ()
{
alert($(this).attr("id"));
});
$("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
}
});
alert($(this).text()); // will alert option text
alert($(this).val()); // will alert option value