I have a string as following:
this is an example of </div>
Then using .replace, I want to get replace </div> with something else.
content.replace(/</div>/g,'function'); //remove </div>
However, the "/" inside of bracket is causing an error. How would I fix this?
You need to escape the slash. Try something like this:
content.replace(/<\/div>/g,'');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With