Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74074

remove all text in brackets javascript

$
0
0

Any suggestion on how to remove text content in brackets?

Example:

<span id="new">Welcome [something.....] home</span>
<span id="new">The Jeep is (asdjfl... ect) nice</span>

var myString = document.getElementsByClassName('new')[0];
myString.replace(/ *\[[^\]]*]/, '');

Goal:

  • Welcome home
  • The Jeep is nice

Viewing all articles
Browse latest Browse all 74074

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>