#Restaurant Order App

6 messages · Page 1 of 1 (latest)

rare field
#

I am having trouble with this app. This has been a lesson that has very difficult for me. I am able to render the menu from the data but I am struggling with using the data attribute to allow buttons to function properly with IDs of the food.

I have had great success until this point. What should I study to understand this more?

I do not just want to complete project I want to understand concepts completely.

I am a systems engineer I do not code much since in my daily job but I did in college 2 years ago. This concept has me feeling frustrated.

jaunty narwhal
#

I understand that all you're looking for is some guidance and not someone to spoon-feed you the answer. Fair enough. In order to understand where the blockage is we need two things from you:

  1. a link to your scrim so we can see your code and determine what's going wrong...

  2. some specific questions... "allow buttons to function properly" isn't really much to go on.

A more detailed question might be "when I click the 'pay' button my handler isn't invoked" - or something along those lines.

rare field
jaunty narwhal
#

If you wish you can setup a github repo with your code...

jaunty narwhal
#

Ok, first: id must be unique in your page - I'll tell you right now that you have problems where you're going to end up with multiple elements with the same id AND for one element there are multiple id's in the same element... first thing you need to do is clear that up.

Next, once you've rendered your menu items you need a way to attach button click listeners to all the buttons... can you think of a way to do that?

(Note, there are several ways to solve this including something called "event delegation" if you've learned that)

And as an additional hint look up how to add data- attributes to an element and think of a way that you might use that information later... (note, you could use the ID of the buttons for a similar purpose but data- is probably more flexible here...)