简体   繁体   中英

Is it possible to invert Jquery selectors to include everything except this?

In Jquery if you want to select something you can use various combinations of selector. Is is possible to invert this selection?

var item = $('#someitemparent').html($('#someitem'));

Is it possible to invert this to everything thing else but not #someitem ?

<div id='#someitemparent'>
<div id='#someitem'>
....
</div>
... otheritems
</div>

使用.not():not()

var item = $('.someitem').not('#notme');

var item = $('*').not('#notme');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM