Search code examples
htmlrubyhpricot

Remove an element's class attribute with Hpricot


How do I do it? E.g.,

<span class="selected" id="hi">HELLO</span>

should become

<span id="hi">HELLO</span>

Solution

  • span = Hpricot(some_html) % "span#hi"
    span.remove_attribute("class")