jquery function based on body class

Soldato
Joined
12 May 2007
Posts
3,896
Location
Bristol
With jquery, I know we attach functions to events. onclick, hover, etc. but I find myself needing to attach a function only if a page has a body class. So, if body has a class (any class), run this function.

Anyone know how I would go about doing that?

Edit:
duh. simple if statement works fine.

if ($("body").attr('class')) {}
 
Last edited:
Back
Top Bottom