Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

44%
+2 −3
Q&A Delete all occurrences of a character in a webpage with vanilla JavaScript

Credit to user Zakk which exampled a solution here. document.body.innerHTML = document.body.innerHTML.replace(/x/g, '*'); Which I've adjusted to my particular need (a particular scope inside th...

posted 2y ago by deleted user  ·  edited 2y ago by Zakk‭

Answer
#3: Post edited by user avatar Zakk‭ · 2022-04-24T16:39:51Z (over 2 years ago)
Added a link to the user who helped : )
  • Credit to user Zakk which [exampled a solution here](https://software.codidact.com/comments/thread/6161#comment-17132).
  • ```javascript
  • document.body.innerHTML = document.body.innerHTML.replace(/x/g, '*');
  • ```
  • Which I've adjusted to my particular need (a particular scope inside the body scope) this way:
  • ```javascript
  • document.querySelector('.new_pages').innerHTML = document.querySelector('.new_pages').innerHTML.replace(/x/g, '');
  • ```
  • Credit to user [Zakk](https://software.codidact.com/users/56561) which [exampled a solution here](https://software.codidact.com/comments/thread/6161#comment-17132).
  • ```javascript
  • document.body.innerHTML = document.body.innerHTML.replace(/x/g, '*');
  • ```
  • Which I've adjusted to my particular need (a particular scope inside the body scope) this way:
  • ```javascript
  • document.querySelector('.new_pages').innerHTML = document.querySelector('.new_pages').innerHTML.replace(/x/g, '');
  • ```
#2: Post edited by user avatar Alexei‭ · 2022-04-24T05:06:06Z (over 2 years ago)
fixed the attribution link
  • Credit to user Zakk which [exampled a solution here](https://software.codidact.com/posts/286304).
  • ```javascript
  • document.body.innerHTML = document.body.innerHTML.replace(/x/g, '*');
  • ```
  • Which I've adjusted to my particular need (a particular scope inside the body scope) this way:
  • ```javascript
  • document.querySelector('.new_pages').innerHTML = document.querySelector('.new_pages').innerHTML.replace(/x/g, '');
  • ```
  • Credit to user Zakk which [exampled a solution here](https://software.codidact.com/comments/thread/6161#comment-17132).
  • ```javascript
  • document.body.innerHTML = document.body.innerHTML.replace(/x/g, '*');
  • ```
  • Which I've adjusted to my particular need (a particular scope inside the body scope) this way:
  • ```javascript
  • document.querySelector('.new_pages').innerHTML = document.querySelector('.new_pages').innerHTML.replace(/x/g, '');
  • ```
#1: Initial revision by (deleted user) · 2022-04-24T02:12:39Z (over 2 years ago)
Credit to user Zakk which [exampled a solution here](https://software.codidact.com/posts/286304).

```javascript
document.body.innerHTML = document.body.innerHTML.replace(/x/g, '*');
```

Which I've adjusted to my particular need (a particular scope inside the body scope) this way:

```javascript
document.querySelector('.new_pages').innerHTML = document.querySelector('.new_pages').innerHTML.replace(/x/g, '');
```