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 8392481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:31:48+00:00 2026-06-09T19:31:48+00:00

Assuming I have some HTML with untagged content, e.g: <html> <body> <p>text in a

  • 0

Assuming I have some HTML with untagged content, e.g:

<html>
<body>
<p>text in a tag</p>
other text outside any tag
</body>
</html>

How can I get to the untagged element? Even document.getElementsByTagName(‘*’) does not contain the untagged element.

TIA

  • 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-06-09T19:31:49+00:00Added an answer on June 9, 2026 at 7:31 pm

    Just in your case you can do simply

    document.getElementById('body').lastChild
    

    However in a more general case you need to loop through children and check for

    a = document.getElementById('body').lastChild
    
    console.log(a.nodeType) // 3
    console.log(a.nodeName) // #text
    

    Here is example on jsfiddle

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

Sidebar

Related Questions

Assuming the following: You have some content currently being displayed in an ASP.NET HTML
I have some text on an HTML page. Need a bookmarklet (no jQuery) that
I have a page that uses jQuery's $.post() method to get some html and
I have come across some strange behaviour, and I'm assuming a bug in Firefox,
Assuming i have a post model with created_at, title, and id. How can i
Assuming I have a comments model and a posts model, What code can I
I have some HTML code that is created dynamically and includes potentially dozens of
Some claim eval is evil. Any regular HTML page may look like: <script src=some-trendy-js-library.js></script>
I have an iOS app that contains a lot of local web content. Some
I have an xml in which i have stored some html under comments like

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.