Home > database >  Transfer input value
Transfer input value

Time:05-25

I have a problem with my web site when I use a form with 2 input I want to transfer the value of the 1st input to the 2nd input with minus sign without using the submit button,knowing that I used the php and js. Please if any of you have an answer I really need it.

CodePudding user response:

Not sure if I understood your question right but if so this is what you are looking for using javascript

<html>
<head>
<script>
function setSecondField(value){
document.getElementById("field2").value = value.value '-';
}
</script>
</head>
<body>

   
<input type="text" name="title" id="field1"  oninput="setSecondField(this)" />

<input type="text" name="title" id="field2"  "/>

</body>
</html>

  • Related