You can simply omit the wildcard as it is optional in this case, but keep the space:
$('#container :not(select)');
Alternatively, use the .not() method to filter out the select after selecting all children:
$('#container').children().not('select');
If your problem is that children of select
are still included, you could explicitly filter those out with the .not() method:
$('#container').children().not('select, option, optgroup');
or select direct children only:
$('#container > :not(select)');
You can try out jQuery selectors at the interactive jQuery selector tester for quick feedback; try for example div :not(ol)
or div > :not(ol)
to get a feel for what difference the direct child (>
) selector makes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…