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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:00:53+00:00 2026-05-27T09:00:53+00:00

I am trying to use javascript to make text bold. I have searched the

  • 0

I am trying to use javascript to make text bold. I have searched the net and it seems that I can do a document.write() after I made my string bold. Isn’t there any way to perform this without opening any new page (in the same html text area)?

function bold()
{
   document.write(selectedText.bold());
}

Edit: I am implementing an Text Editor and I am using a HTML TextArea, and I am trying to add all the functionality such as bold, italic, etc. I want to be able to select part of the text written and make it bold.

  • 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-27T09:00:54+00:00Added an answer on May 27, 2026 at 9:00 am
    // method 1: direct write out something with bold tags
    document.write('<b>My Bold Text</b>');
    
    // method 2: add an element styled to be bold
    var span = document.createElement('span');
    span.innerHTML = 'My Bold Text';
    span.style.fontWeight = 'bold';
    document.getElementsByTagName('body')[0].appendChild(span);
    
    // method 3: add an element classed to be bold
    // add style sheet first:
    //   <style type="text/css">.bold { font-weight: bold; }</style>
    // then the jS:
    var span = document.createElement('span');
    span.innerHTML = 'createElement.className - My Bold Text';
    span.className = 'bold';
    document.getElementsByTagName('body')[0].appendChild(span);
    

    Something like that? Otherwise, please be more specific with your question.

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

Sidebar

Related Questions

I am trying to use the following script in asp.net: <script language=javascript type=text/javascript> function
I have a big red button and I'm trying to use javascript to perform
I'm trying to use the replace function in JavaScript and have a question. strNewDdlVolCannRegion
I'm trying to use Firebug to debug some Javascript that entails blur and focus
I'm trying to develop an application that will use getImageData in javascript in Firefox
I'm trying to make a page that shows how to enable JavaScript in various
I am trying to make use of this Syntax highlighter. I have tried to
I'm trying to use the value of an asp:HiddenField control in javascript after postback
So I have this code, which I am trying to use to make it
I have an extremely simple example trying to use Data Annotations with unobtrusive javascript

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.