filter

by Kumaresan S

HTML

<DIV class="one">
one
  <DIV class="one">
  two
    <DIV class="one">
    three
    </DIV>
  </DIV>
</DIV>

JavaScript

var $div = $("div");

if ($div.length > 1) {
   $div.not(':first').remove()
}