Here we want to show the html content inside the <li> element in it's title attribute which will be visible on hovering each <li> element.
This is a simple to use and understand jQuery code. Let's check..
$(' .menu ul li ').hover(function() { $(this).attr({ title: $(this).html() }); }On mouse In, the above function creates a title attribute for the <li> element.
.:: title: $(this).html() ::. this part fetches the html content present inside the <li> element and prints it as the title attribute's text.
,function() { $(this).attr({ title: '' }); } );And in the end on mouse Out this part writes a blank title attribute for the <li> element.
Copyright © ajDeskta Blog. All rights reserved. Design and site maintenance by ajDeskta.