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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:40:33+00:00 2026-06-05T16:40:33+00:00

I have the following code in HTML and wanted to replace them using javascript

  • 0

I have the following code in HTML and wanted to replace them using javascript

Original code

<td class="tabButton dijitHidden tweetsTabButton selectedTab" dojoattachpoint="tweetsTabButton" data-type="twitter" style="display: none;">
Tweets
<div class="arrow-up"><div class="arrow-up-content"></div></div>
</td>

Replace it to

<td  dojoattachpoint="tweetsTabButton" data-type="twitter" style="display: none;">
<h2>Tweets</h2>

</td>
  • 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-05T16:40:34+00:00Added an answer on June 5, 2026 at 4:40 pm

    By the question contents, and the comments currently present, you need to:

    1. wrap the text Tweets with an element, specifically <h2></h2>
    2. remove the class attribute from the td to disable CSS
    3. use pure JavaScript
    4. Assuming a table ID present and using the data-type attribute as verification!

    See this working Fiddle Example!

    javaScript

    // get the table by ID
    var table = document.getElementById("table-id");   
    
    // get the table cells
    var cells = table.getElementsByTagName("td");   
    
    // for each table cell found
    for (var i = 0; i < cells.length; i++) {   
    
        // get the attribute 'data-type'
        var status = cells[i].getAttribute("data-type");
    
        // if 'data-type' contains the value 'twitter'
        if ( status == "twitter" ) {   
    
            // create the 'h2' element
            var h2 = document.createElement("h2");
    
                // append a textnode to the created element with the text 'Tweets'
                h2.appendChild(document.createTextNode('Tweets'));
    
            // remove the current text 'Tweets'
            cells[i].removeChild(cells[i].firstChild);
    
    
            // remove the class atrribute
            cells[i].removeAttribute('class');
    
            // append the new element to the current 'td'
            cells[i].appendChild(h2);
        }  
    }
    

    Note: Could be optimized, but as is you can see what’s happening. Also the comments are there to guide you through, remove when in production.

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

Sidebar

Related Questions

In my view I have the following code: @using (Html.BeginForm()) { @Html.TextBox(Date2, Model.Date2) <br/>
I have the following html code: <form> <table> <tbody> <tr> <td> <span>Quantity<span class=pull-right>3</span> <input
I have the following html code with Jquery Sorting <div class=sortable style='width:700px; margin: 0
Suppose you have this following code in HTML - <div id=pattern> <span class=a>Content</span> </div>
I have following HTML code: <div id=wrapper> <div class=page id=first> Test<br/> Test<br/> Test<br/> Test<br/>
I have following HTML code: <section class=indent-1> <!-- Section 1 --> <section> <div>Some content</div>
I have the following code: HTML <div id='foo'> <input type='checkbox' value='english' name='bar[english]' /> <input
I have the following code in html, I cannot get the Function call back
I have the following code in html: <select> <option text=item9 value=9></option> <option text=item10 value=10></option>
I have the following html code: I saw that for Watir-webdriver the Watir::Image.file_size method

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.