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

  • Home
  • SEARCH
  • 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 6572173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:58:21+00:00 2026-05-25T14:58:21+00:00

How to replace <b></b> tag with <strong></strong> tag to a specific div? ex: <div

  • 0

How to replace <b></b> tag with <strong></strong> tag to a specific div?

ex:

<div id="aaa">hello<b>wow</b>!</div>

using javascript to replace with

<div id="aaa">hello<strong>wow</strong>!</div>

please help! thanks in advance.

enter image description here

***** Why I’m try to do is change the output HTML code <b></b> to <strong></strong> , in order to get W3C validation. Can I do that? **

Or Is there any solution that can use ASP.NET+C# to do that?

  • 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-25T14:58:22+00:00Added an answer on May 25, 2026 at 2:58 pm

    Here you go:

    var root, elems;
    
    root = document.getElementById( 'test' );
    elems = root.getElementsByTagName( 'b' );
    
    toArray( elems ).forEach( function ( elem ) {
        var newElem = document.createElement( 'strong' );
        newElem.textContent = elem.textContent;
        elem.parentNode.replaceChild( newElem, elem );    
    });
    

    where toArray is your preferred array-like to array converter function. I use this one:

    function toArray( arrayLike ) { return [].slice.call( arrayLike ); }
    

    Live demo: http://jsfiddle.net/mJSyH/3/

    Note: this code doesn’t work in IE8.

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

Sidebar

Related Questions

What is a good way to replace an HTML tag like: Old : <div
I have to replace the content of this xml string through java <My:tag>value_1 22&#xA;value_2
Note the tag: VBA , not VB6, not VB.NET. This is specific to VBA
I'm trying add a bold/strong tag the line headings of the follow string/text block:
I've got a thumbnail replace solution, I need to add an a tag around
The below string is coming from a DIV tag. So I have enclosed the
i got help ( Select a Tag with a Selector from a Text Variable
I'd like to replace all the tag-looking parts in a String if those are
I have string containing many of HTML tag of exactly that construction: Hello <img
I would like to replace (all occurences) of the HTML <font> -tag in a

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.