Below is simple jQuery
code snippets to replace
all the dots (.) present on HTML page and then replace it with hyphen.
var strNewString = $('body').html().replace(/./g,'-');
Remember: Replace functions returns a string which contains the updated text. So you need to first assign into a variable and then re-assign it.
Instead of, (.) or "-", text can be anything. All you need is to make change in the replace function arguments and you are good to go.
Feel free to contact me for any help related to jQuery, I will gladly help you.
© Copyright 2006–2022 Learning jQuery and participating authors. Written content on this site is under a Creative Commons License. Code examples are under your choice of MIT or GPL license.
Development & Design by Landocs with WordPress