get value from input 1 and set on input 2

i have 2 input fileds, the upper is “input1” and the other is “input2”.
i want that the value of input1 display also on input2.

this is my code, but its not working
$w.onReady(function () {
let textValue = $w(’ #input1 ').value;
$w(’ #input2 ').value = textValue;
});

 $w.onReady(function () { 
 $w('#input1').onChange((event) => {
$w('#input2').value = $w('#input1').value;
})
})

i want to mark that “input1” is changing all the time beacuse its a field on dynamic page

is it a user input or just an un-eidtable text?

i want that “input1” will be hide, i need it just to save the value and set it to “input2” for send it to db collection. (its a user input that display the ID of student)

You have to add more details. If you don’t need the user to directly change it, why do you need it to be on your page at all (even though it’s hidden)? You can just save it to your DB.

and anyway you should explain the desired event flow in details.

its a dynamic page of student that connect to “students” db. the teacher can add feedback that saved in “feedbacks” db. when i add feedback without to insert again the students id (that apear on input1), the feedback send to db without attribution to student id

i want that the teacher insert a feedback on a student page without to enter his id again

sorry, but it still isn’t clear.
First, you don’t have to put the student id in a hidden graphic element, you can just set it by code.
Second, I can see here 1 field with Id and another field with “Level of education”, so I’m confused - do you want the fields to be the same or not?

i try your option. and its work- the input2 change according to input1. but when i press “submit” to sent it to db the value on input isnt display

I’m not sure what exactly you’re saying. Did it fail to submit? did you remember to connect this field to the dataset?
(I’m assuming you submit the form to a dataset via the editor connection. Let me know if I’m wrong).