tags:

views:

33

answers:

2

i am trying to prevent all elements within a div from being selected. this is not working.

$('*').not('#someid > *')

+1  A: 

Use filter():

$("*").filter(function() {
    return !$(this).closest("#someid").length;
})

...actually doing some more testing, this should also work:

$("*:not(#someid *)")
nickf
what if $("*").bind("click",function()how do i add it then ?
Jaaaaabbb
`$("*").filter(...).bind("click", function() {...})` or`$("*:not(#someid *)").bind("click", function() {...})`
nickf
A: 

The only problem with your approach is that you're asking for immediate children. If you remove the > it should work fine:

$('*').not('#someid *');
Seb
yup this was the problem.
Jaaaaabbb