开发者

prevent all elements within a div from being selected. \

开发者 https://www.devze.com 2022-12-08 03:12 出处:网络
开发者_如何学Pythoni am trying to prevent all elements within a div from being selected. this is not working.

开发者_如何学Pythoni am trying to prevent all elements within a div from being selected. this is not working.

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


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

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


Use filter():

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

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

$("*:not(#someid *)")
0

精彩评论

暂无评论...
验证码 换一张
取 消