Forums

.innerHTML - how to make it work ?

adam M 14 Jun, 2024

I have a simple form with 2 fields

field1 - text

field2 - html code with some script :

var abc = document.getElementById('field1');

abc.innerHTML = "new value";

I'm afraid the displayed value of field1 is still blank, DOM is not updating :( 

When I "examine" the page with chrome function I can see that field1=new value

<input type="text" name="field1" id="field1" placeholder value autocomplete="off" >new value</input

... but on the display it is still empty, and also when I submit the form, the field1 value is also empty.

How can I update the value of field1 , so that it will be displayed and submitted correctly ?

Max_admin 16 Jun, 2024
Answer
1 Likes

you should use

abc.value = "your value"
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
adam M 16 Jun, 2024
1 Likes

bingo ! problem solved !!!  Thanks a lot :)

You need to login to be able to post a reply.