Fix for Form submission from a text element

I wrote a simple code to make value of the text box to the text element text when clicking a button and it changes when clicking but when submitting to a CMS the value that from the text box is not stored.

Is there a way to fix this issue.

Yes, here’s the fix: