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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:56:54+00:00 2026-05-24T01:56:54+00:00

I am learning this stuff so this is my most simple script: var t

  • 0

I am learning this stuff so this is my most simple script:

var t  = document.createElement("table"),
    tb = document.createElement("tbody"),
    tr = document.createElement("tr"),
    td = document.createElement("td");

    t.style.width = "100%";
    t.style.borderCollapse = 'collapse';
    t.border=1;



    // note the reverse order of adding child        
    tr.appendChild(td);
    tb.appendChild(tr);
    t.appendChild(tb);

   // more code to populate table rows and cells
   document.getElementById("theBlah").appendChild(t);
   alert(t);
   }

Now I want to add something that will be displayed in <td>, so I figured:

td.appendChild(document.createTextNode(title)); 

which works great…
but if title contains html, for example a simple bold tag, like so Hello<b> name!</b>
how do we do that?

I think we create a new element for <b> but… after that, i have no idea how to do it.
Just to clarify, I want the end result to be that Hello<b> name!</b> ends up in the TD tag like this:

<td>Hello<b> name!</b></td>

Please help!!

EDIT;
Yes, I know I can do this via InnerHTML, but I need to do it this way to get it past Firefox AMO policies
Sorry shoulda mentioned this earlier…

  • 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-24T01:56:56+00:00Added an answer on May 24, 2026 at 1:56 am

    Try:

    var td = document.createElement("td");
    var b = document.createElement("b");
    b.appendChild(document.createTextNode(" name!"));
    td.appendChild(document.createTextNode("Hello"));
    td.appendChild(b); 
    

    Result: <td>Hello<b> name!</b></td>

    Example: http://jsfiddle.net/hGF3e/

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

Sidebar

Related Questions

I'm still learning this stuff, but for the most part, my understanding is that
Still learning this jQuery stuff.... I like this ajax page loader; it works for
Saw this www.workatplay.com/ website, and got fascinated on how simple and nice stuff can
Im learning lisp and im pretty new at this so i was wondering... if
I'm learning objective-C and Cocoa and have come across this statement: The Cocoa frameworks
I'm still learning ASP.NET and I often see code like this throughout parts of
This is going to sound like a silly question, but I'm still learning C,
I have recently started learning F#, and this is the first time I've ever
I am learning Ruby on Rails so I'm sure I'll find this out sooner
I'm learning ASP.NET MVC Framework, From some articles like this , it seems that

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.