jeudi 22 avril 2021

How do I get mu on change event to populate the input from one field into the input of another field

I'm trying to say in my code below that when field1.value is input, populate field2 with that value/text. this is being done through an on change event, but its not running the way I think it should.

this works:

if (field1.value=='Hello') {field2.value='World'} else {field2.value='foo';}

but I'm trying to get the below to work and its not:

if (field1.value=='%') {field2.value='field1.value'} else {field2.value='';}

Aucun commentaire:

Enregistrer un commentaire