$('body, html').replace(".", " ");
I tried it, but this one doesn’t work. I want to replace dots to spaces in the whole page.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Does jQuery have a
.replace()method? You seem to be trying to use theString.replace()on a jQuery object.You could try the following instead:
Or if you wanted to do it for a more select select of elements, say only those with a certain class:
Note that
.replace()is using a regex with thegflag set so it does a global replace rather than just replacing the first match.Note also that if you replace the body’s html it effectively removes and recreates all your elements so it will kill any event handlers already bound – so do it before attaching your handlers.