#Form Data input name is not working in restaurant-ordering-solo-project

5 messages · Page 1 of 1 (latest)

velvet slate
#

Hi, so this is happening because you declared the variable 'name' inside the click handler function, making the variable accessible only inside the event handler.

#

To solve you could do this:

#

There are different approach to solve the same problem, but this one fix the bug. Hope it helps, have a great code!

trail garden
# velvet slate To solve you could do this:

Thank you bro. Interesting fact is that in Essential JS lesson was used the method I tried to use, but I could not do it with that method. It was used in annoying cookie consent lesson

trail garden
#

But anyway it works