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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:50:48+00:00 2026-05-26T00:50:48+00:00

I am trying to remove the text, Hi Mom from an html page using

  • 0

I am trying to remove the text, “Hi Mom” from an html page using javascript after it loads.

I can not use any framework like jQuery.

I can use the DOM, but will not know where it is, other than it’s wrapped in a tag somewhere.

Can this be done in plain old Javascript?

  • 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-26T00:50:49+00:00Added an answer on May 26, 2026 at 12:50 am

    Here’s a pretty simple DOM walk you can do.

    There could be improvements if you thought there may be more than once occurrence in the same text node, but it doesn’t sound like that’s the case.

    DEMO: http://jsfiddle.net/UrNWb/

    var text_to_remove = "Hi Mom";
    
    function dom_walk( el ) {
        if( el.nodeType === 1 && el.childNodes.length ) {
            if( el.nodeName.toLowerCase() !== 'script' ) {
                for( var i = 0; i < el.childNodes.length; i++ ) {
                    dom_walk( el.childNodes[ i ] );
                }
            }
        } else if( el.nodeType === 3 ) {
            if( el.data.indexOf( text_to_remove ) !== -1 ) {
                el.data = el.data.replace( text_to_remove, '' );
            }
        }
    }
    
    dom_walk( document.body );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to remove JavaScript from the HTML. I can't get the regular
I'm trying to remove some unwanted whitespace from JavaScript files, and combine files using
I am trying to remove text from a dropdown menu using a Jquery plugin
I have a html text file and I am trying to remove any HTML
I am trying to extract text from body downloaded via ajax. I can not
I am trying to remove some <span style=something not constant> from a text and
I am trying to remove the attribute xmlns=http://webdev2003.test.com from the following xml using xsl/xslt,
I'm trying to remove vowels from a text file and am having some trouble.
I am trying to remove a certain color from my image however it's not
I have a string of text that I am trying to remove from 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.