Can I change document content in a html page using the JS API?

Can I change document content in a html page using the JS API? For example, replace text in a document

Hello,
Yes, it is possible to change (for example, replace) document content using API methods, you can have a look at the following plugin example: Search and replace