views:

150

answers:

2

I am using a jquery context menu plugin (http://www.trendskitchens.co.nz/jquery/contextmenu/) which works fine but I want to work for all children of a selector currently I have the below but it only applies to divs with class area and I need it to apply on div's with class area and all its children.

$('#container-area .area').contextMenu()

Any ideas on wildcard jquery selectors tried * with no luck

Lee

+2  A: 

This should work, using .andSelf() (documentation):

$('#container-area .area').children("div").andSelf().contextMenu();
Nick Craver
what if the children aren't all div's?
monkeylee
@monkeylee - Just remove the `"div"` part and make it `.children()` to get all children if that's what you're after.
Nick Craver
A: 
$('#container-area .area').contextMenu().find('*').contextMenu()
Praveen Prasad