I want to remove everything before and after form. I am new in jquery and English.
<h1>hello</h1>
<span>world</span>
<form id=f>
<input name=g>
<input type=submit>
</form>
<div>footer</div>
<p>more</p>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’d go for:
i.e. take the bits out of the DOM that you want to keep, and then completely replace the current body with those elements. This will ensure it works even if the elements you want are nested a long way down the DOM tree.
See http://jsfiddle.net/rwWp9/1/