How to bind text to the input box through WiX code??

I have two text input named - firstName and Surname. Also I have one hidden input box named “Fullname”. Now I want user to enter firstname and surname but then I want use some code to join them and set the combined value to Fullname. I tried to use this :

let firstname = $w(‘#input1’).value;
let surname = $w(‘#input2’).value;
let fullname = firstname +" "+ surname;
$w(‘#fullname’).value = fullname; // this line is not working

Please help me!!

Where do you have this code? That is, what causes it to run?