How can I code in Javascript without getting a syntax error in Web Development Fundamentals | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I code in Javascript without getting a syntax error in Web Development Fundamentals

I'm trying to make the ticketing website in Web Development Fundamentals 34.2 but I keep getting a JavaScript syntax error each time I run my code. Here is my entire code: Html html> <body> <section> <h1>The Eiffel Tower</h1> <a href="https://test.com" target="-blank"> https://sololearnassets.azureedge.net/eiffel-tower.jpg </a> <img src="https://sololearnassets.azureedge.net/eiffel-tower.jpg" alt="Some Image" width="30%" > <p><strong>Eiffel Tower</strong> is a wrought-iron tower that stands <strong>1,063 ft (324 m)</strong> tall in <strong>Paris</strong></p> <p>Currently, the <strong>Eiffel Tower</strong> is the most-visited monument in the world with over <strong>7 million</strong> visitors a year.</p> <p>Visitors can choose to go up using the Tower lift or the stairs. There are <strong>1,665 steps</strong> to the top.</p> <p><b>Transport:</b> <ul> <li>Bus:lines 42,6,72,82 and 87.</li> <li>Metro:Trocadero,Ecole militaire.</li> <li>Train:Champ de Mars-Tour Eiffel,line C.</li> </ul> <table border="1"> <p><b>Prices:<p> <tr> <th>Category</th> <th>Price</th> </tr> <tr> <td>Adults</td> <td>$12</td> </tr> <tr> <td>Children</td> <td>$5</td> </table> </section> <section id="buy" <form> <div class="form-section"> <label for="Adults">Adults:</label><br> <input type="number" id="Adults"> </div> <div class="form-section"> <label for="Children">Children:<label><br> <input type="number" id="Adults"> </div> <div class="form-section"> <input type="button" value="Buy"> </div> </form> </section> <footer> <p>&copy;Copyright</p> </footer> </body>

30th Dec 2022, 2:59 PM
Radley Porterfield
7 Answers
+ 5
please tag "web" not your name. link your complete code: Go to Code section, click +, select Web, insert your code save. Come back to this thread, click +, Insert Code, sort for My Code Bits, select your code. Do not paste the code in the description, we cannot run it from there
30th Dec 2022, 3:22 PM
Lisa
Lisa - avatar
+ 4
I added again some comments in the code, I hope you can find them. I think your calc function does not yet take into account the different ticket prices. In your css, I added some margin to the price table to prevent it from getting hidden when scrolling to the end. There might be better options to solve that. 🤔 https://code.sololearn.com/WpQfTi042ozq/?ref=app
30th Dec 2022, 10:46 PM
Lisa
Lisa - avatar
+ 3
great! yes, ask in Q&A and I or others can help you to figure it out :)
30th Dec 2022, 11:44 PM
Lisa
Lisa - avatar
+ 2
You did not give the button the id that you used in the js. I noticed some more issues, see my comments in the js and html tabs: https://code.sololearn.com/WcGaIaKJgE0t/?ref=app
30th Dec 2022, 7:14 PM
Lisa
Lisa - avatar
30th Dec 2022, 4:40 PM
Radley Porterfield
+ 1
Thank you for your help. If I have anymore questions I'll ask you. 😊
30th Dec 2022, 11:24 PM
Radley Porterfield
0
I fixed the code. Also, when I run the CSS it covers up the Adults and children category and prices. And when I click the buy button after putting the number of tickets for adults and children all it does put the numbers next to each other. Can you help me with that? https://www.sololearn.com/compiler-playground/WxjGQwezXSdK
30th Dec 2022, 10:27 PM
Radley Porterfield