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