Jquery Show/Hide on mouse

This is a simple function that hides an item when the mouse leaves. The object can be visible initially and will only dissapear once the mouse has entered AND left. $(‘div.mouse.LeaveHide’).on({ mouseover:function(e){ $(e.target).one({ mouseleave:function(e){ $(e.target).hide(); } }); } });

Find an IFrames id

There is an HTML5 (originally IE extension) property frameElement on window: alert(frameElement.id); But this is not globally supported; you won’t get it in Google Chrome (at the time of writing; version 7) or in older versions of the other popular non-IE browsers.

jQuery – Get a childs relative position

When processing sortables etc. Its handy to be able to get the index of individual items. Heres how you find the position of an li within a list: var position = $item.parent().find(’> li’).index($item) + 1;