monkeylee
monkeylee

Reputation: 965

jquery apply context menu on all children

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

Upvotes: 0

Views: 663

Answers (2)

Praveen Prasad
Praveen Prasad

Reputation: 32107

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

Upvotes: 0

Nick Craver
Nick Craver

Reputation: 630429

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

$('#container-area .area').children("div").andSelf().contextMenu();

Upvotes: 2

Related Questions