# Page editor saves javascript changes

**URL:** <https://forum.mautic.org/t/page-editor-saves-javascript-changes/9896>\
**Category:** Development\
**Created:** [November 14, 2017, 4:26am UTC](https://forum.mautic.org/t/page-editor-saves-javascript-changes/9896 "2017-11-14T04:26:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![copyhold](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@copyhold](https://forum.mautic.org/u/copyhold)\
**Post date:** [November 14, 2017, 4:26am UTC](https://forum.mautic.org/t/page-editor-saves-javascript-changes/9896/1 "2017-11-14T04:26:10Z")

</div>

He||o All  
  
I found a strange behavior of page editor.  
  
In my custom theme I have a JS on page that changes the page DOM, - adds some elements.  
  
I’ve found that those changes are saved in page template in database.  
  
This was really bad in my case - the generated by JS HTML accumulated in the page code.  
  
  
  
How could this be avoided? Is there a way to know if the page is currently edited?

---

<div class="post-metadata">

**Author:** ![copyhold](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@copyhold](https://forum.mautic.org/u/copyhold)\
**Post date:** [November 14, 2017, 4:26am UTC](https://forum.mautic.org/t/page-editor-saves-javascript-changes/9896/2 "2017-11-14T04:26:10Z")

</div>

He||o All  
I found a strange behavior of page editor.  
In my custom theme I have a JS on page that changes the page DOM, - adds some elements.  
I’ve found that those changes are saved in page template in database.  
This was really bad in my case - the generated by JS HTML accumulated in the page code.

How could this be avoided? Is there a way to know if the page is currently edited?
