[Solved] How to copy the selected value from one form input field to another form input field


Here is another way, without jQuery:

<script>
function update(){
    let updateValue = document.getElementById("name").value;
    document.getElementById("name2").value = updateValue;
}
</script>

<form action="/new"  method="POST" >

<input  list="name" type="text" name="name" id="name" onchange="update()">
<datalist id="name">
    <option value="Hello">
    <option value="Hi">
</datalist>
<button>Submit</button> 
</form>

<form action="/new1" method="POST">
<input type="text" name="name" id="name2" value="name" > 
</form>

1

solved How to copy the selected value from one form input field to another form input field