2010-05-04 101 views
4

我想写一个CSS选择器,选择除了脚本元素与hpricot,我可以很容易地选择所有内容的select-me div,然后删除脚本元素,但我是想知道,如果它可以使用一个选择,这将排除脚本元素:CSS选择器排除元素,hpricot

<div class='select-me'> 
<p>This is some text</p> 
<script> 
javascript would be here 
</script> 
<p>This is some text</p> 
</div> 

所以最终我得到的结果:

<div class='select-me'> 
<p>This is some text</p> 
<p>This is some text</p> 
</div> 

干杯

回答

6

你可以请尝试:

"div.select-me :not(script)"