Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6649687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:48:14+00:00 2026-05-26T00:48:14+00:00

I have an html page called test.html, here is it’s content: <!DOCTYPE html PUBLIC

  • 0

I have an html page called test.html, here is it’s content:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
    <title></title> </head> <body style="margin: 0; padding: 0; background: #d9d9d9;">
    <form name="form1" method="post" action="NewsLetterPreview.aspx?NewsletterID=1" id="form1">
    <div>
        <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTA3NzM3OTc4N2Rkkk3StA9iwyEdCoR43JPpw6OyRHubNTnbXatTbxCXsVA=" />
    </div>
    </form> </body> </html>

I then have another page which I am using $.get to get the content of the page:

$.get("test.html", function (data) {
            alert($(data).find("body").html());
        });

However the alert($(data).find("body").html()) returns null. It does the same for the alert($(data).find("form").html()) also. Only if I specify alert($(data).find("div").html()) does it return the input field.

How can I select the body / form?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:48:15+00:00Added an answer on May 26, 2026 at 12:48 am

    If you want to replace your body with fetched HTML, this should do it.

    $.get("test.html", function (data) {
                $(body).html(data);
            });
    

    EDIT:

    Missread your question.

    It’d suggest you to use json or .replace() instead.

    Example: alert(data.replace(/^.*?\<body\>(.*?)\<\/body\>.*$/, "$1"));

    If you want body tags included: alert(data.replace(/^.*?(\<body\>.*?\<\/body\>).*$/, "$1"));

    I don’t think jquery can work with HTML the way you wish. Either include it in the code and then use regular functions or find another workaround.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following snippet: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
I have an html page which has a link called open. Once the link
I have created a simple html page to test the localstorage and for the
I have HTML page with several frames on it. One of frames(called Main) contains
I have a test page that displays two images. One called hello.bmp and another
I have the main page (called 'main.html'), with a link on it, with which
I have a page called android.html with a button with an id of detect.
I have HTML page where windows media player is embedded. It works very well
I have HTML page with some HTML element with ID=logo . I need to
How to find all files in directory? I have HTML page in some directory.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.