2010-05-04 96 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)"