Jump to content

jQuery: How to delete the first <div> child inside an element? Or next previous brother <div>?


pstein

Recommended Posts

Assume I have a html code similar to

<div class="foobar" ....>
   <p>
   <div> first stuff</div>
   <div class="sec"> second stuff </div>
   .....
</div>

1.) How can I delete the first <div> element INSIDE the <div> parent element with class="foobar"?

2.) How can I delete the first <div> brother element BEFORE the <div> element with class="sec"?

If possible suggest a jQuery code. Otherwise JavaScript is acceptable too.

Thank you

Peter

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...