How to fill out this simple html form that place on the Google site page

Hello, I tried the example of Mr. Taifun how to fill out this simple html form, its work fine on single html file but when I place the form on the google site page, it doesn’t work at all. Does anyone know the cause? Sorry if this question looks outdated

ID’s must be equal to id attribute in HTML. If your HTML contains:

<input id="user">

Which means you need to use same ID in script:

document.getElementById('user').value = "my value";

Make sure the input IDs is not overridden by any other element. If you’re not sure what ID an input is using, you can “Inspect Element” on your browser.

Also, I recommend executing the JavaScript after loading the page.

I’ve done it, you can see it in the screenshot of the html script that I included, I’ve tried it in single html its working fine, but when I place the same script on the google sites page, it doesn’t work

If Google Sites loads the script in a <iframe> (you can verify by looking the “Inspect Element”), then sadly you can’t access the iframe and its content in any way.

How stupid I am, that explanation makes a lot of sense

Thanks for the information. I got it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.