4

I am trying to write a CSS selector that select everything except the script elements with hpricot, I can easily select the all the contents of the select-me div and then remove the script elements but I was wondering if its possible to use a selector which will exclude the script elements:

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

So in the end I get back:

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

Cheers

RailsSon
  • 19,897
  • 31
  • 82
  • 105

1 Answers1

6

You can try:

"div.select-me :not(script)"
karim79
  • 339,989
  • 67
  • 413
  • 406