Questo è un esempio di quello che vorresti fare.
codice:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <label for="destinazione">Destinazione</label> <input id="destinazione" type="text"><br> <label for="ritorno_da">ritorno_da</label> <input id="ritorno_da" type="text"> <script> const destinazione = document.getElementById('destinazione') const ritornoDa = document.getElementById('ritorno_da') destinazione.addEventListener('keydown', (e) => { if (e.keyCode === 9) { e.preventDefault() ritornoDa.value = e.target.value } }) </script> </body> </html>

Rispondi quotando