Home > Blockchain >  JavaScript - How to update Source Code via JS
JavaScript - How to update Source Code via JS

Time:04-18

I have a html-form with hidden input elements.

Within JS I use

document.getElementId("xxx").value = "test";

to update hidden form elements.

After updating, I can see the updated content.

alert(document.getElementId("xxx").value);

All good so far.

But when I look in the source code, the element value is NOT changed.

Is this possible at all? If so, how can I change the input-value so it is also reflected in the source code, but without reloading the website.

Thanks, BM

CodePudding user response:

Source code in HTML does not change Only DOM elements is changed You can inspect elements to see the changes of DOM in console

  • Related