I have an LI with A tag in it.
<li title="LI TEXT" id="test">
ELEMENT WITH HREF <a href="#" title="HREF TEXT">HREF</a>
</li>
I want to create jquery tooltip for the LI and default tooltip for its child elements. But this does it both for the jquery elements for LI and its childs.
$("#test").tooltip();
Okay, what you've described is quite easy with the
items
option. Simply include a selector restriction for the items you want to show their tooltips, e.g. the same as the original selector that you're calling.tooltip()
on:The question doesn't make this explicit, but you probably also want to show only one (rather than 2) tooltips when you hover over the children element. To do that, you can disable and reenable the parent's tooltip on the
mouseenter
andmouseleave
events. JQuery provides a nice shortcut for that with thehover
function:Note that you can use any relevant selector, not necessarily
$(this).parent()
, depends on how your HTML is structuredHere's the example fiddle updated: http://jsfiddle.net/957r8x51/