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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:53:59+00:00 2026-06-05T07:53:59+00:00

my question was pretty much explained up in the title. How do I get

  • 0

my question was pretty much explained up in the title. How do I get HTML tags inside of a Javascript Text Node? The result of my code on the page is…

<a href="http://www.example.com">Click Here</a>

However, I want “Click Here” to be a link. I am new to Javascript, so this would help me out a lot. Below is an example of what I’m talking about…

<div id="mydiv">
</div>
<script type="text/javascript">
var mynode=document.createTextNode('<a href="http://www.example.com">Click Here</a>');
document.getElementById('mydiv').appendChild(mynode);
</script>
  • 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-05T07:54:01+00:00Added an answer on June 5, 2026 at 7:54 am

    You can’t put links in a text node. Links are elements. Elements can (sometimes) contain text nodes, but the reverse is not true.

    You need to create an element, set attributes on it, then append text to that element.

    var link = document.createElement('a');
    link.setAttribute('href', 'http://www.example.com');
    link.appendChild(document.createTextNode('Click Here'));
    document.getElementById('mydiv').appendChild(link);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The title of the question pretty much states the problem. Is it possible?
The question is pretty much in the title, but I will elaborate. I have
Pretty much the same as this question. But I can't seem to get this
The title pretty much asks the whole question - How can I clear ONLY
Title pretty much explains most of my question. I will provide some context. I've
The title pretty much explains the question. I have a user control loaded into
The title pretty much explains my question. I would like to be able to
I have a question that has pretty much been asked here: asp.net mvc Html.ActionLink()
So The title pretty much explains my question. What is the difference between stdout=subprocess.PIPE
I think the title of my question pretty much sums it all up. I'm

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.