Jquery learn | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Jquery learn

why can't I take the value from the input field https://code.sololearn.com/W7cCuXg63Qf6/?ref=app

23rd Dec 2018, 1:12 AM
Hafizd Jubaidir
Hafizd Jubaidir - avatar
2 Respostas
+ 4
Because it retrieves the value right after the document is loaded. You need to included it inside the click event.
23rd Dec 2018, 2:40 AM
Toni Isotalo
Toni Isotalo - avatar
0
varĀ is scoped to the nearest function block andĀ letĀ is scoped to the nearestĀ enclosingĀ block. As if you want to use let, then as Toni Isotalo mentioned use it inside click event
23rd Dec 2018, 3:21 AM
Mayank Dhillon
Mayank Dhillon - avatar