Adding methods to enums

I used to often find myself creating utility classes to process enums to create markup or carry out particular actions based on the enum value. Since extension methods have been introduced I have started using them to add processing methods…Continue Reading →

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){ $({ mouseleave:function(e){ $(; } }); } }); jQuery like Closest()

Here is a very simple .Closest() function like the jquery one. public static class ControlExtensions { public static Control Closest(this Control control, Type type ){ Control closest = null; Control parent = control.Parent; while(closest == null && parent != null){ if(parent.GetType().ToString() == type.ToString()){ return parent; } parent = parent.Parent; } return null; } }

Find an IFrames id

There is an HTML5 (originally IE extension) property frameElement on window: alert(; 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.