Friday, December 18, 2009

How to add tooltips to dropdownlist items, using jquery?

This little piece of code is a simple way to put tooltips in dropdownlist items of all dropdownlist that exists on the web form, using jquery.

$(document).ready(function() {
$("select").each( function (){
var i =0;
var sel = this;
for(i=0;i<sel.length;i++){
sel.options[i].title = sel.options[i].text;
}
}
);
}
);

1 comment: