EstherH Posted December 12, 2022 Share Posted December 12, 2022 Hi! I'm trying to add a BMI Calculator on my website but the code doesn't run (I found it online). You do see the image of the BMI tool, but it doesn't make any calculations. I've also contacted customer support and they can't help :/. See pictures and code below. FYI the BMI formula is as following: BMI = kg/m2. I would be very grateful with any help! Esther ----- Code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div class="calculator-container"> <h1>BMI CALCULATOR</h1> <p>Height in meters:</p> <input class="height-input-field" type="text"> <p>weight in kilograms:</p> <input class="weight-input-field" type="text"><br> <button class="calculate"> Calculate</button> </div> <h3 class="result"></h3> <p class="result-statement"></p> <script src="script.js"></script> </body> </html> Link to comment
Beyondspace Posted December 12, 2022 Share Posted December 12, 2022 2 hours ago, EstherH said: Hi! I'm trying to add a BMI Calculator on my website but the code doesn't run (I found it online). You do see the image of the BMI tool, but it doesn't make any calculations. I've also contacted customer support and they can't help :/. See pictures and code below. FYI the BMI formula is as following: BMI = kg/m2. I would be very grateful with any help! Esther ----- Code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div class="calculator-container"> <h1>BMI CALCULATOR</h1> <p>Height in meters:</p> <input class="height-input-field" type="text"> <p>weight in kilograms:</p> <input class="weight-input-field" type="text"><br> <button class="calculate"> Calculate</button> </div> <h3 class="result"></h3> <p class="result-statement"></p> <script src="script.js"></script> </body> </html> 1. Have you checked the link for js code? You should try uploading the script file on squarespace and use the following link on src value: <script src="/s/script.js"></script> Or add the js directly on <script> tag 2. I think you should only add the HTML <div class="calculator-container"> <h1>BMI CALCULATOR</h1> <p>Height in meters:</p> <input class="height-input-field" type="text"> <p>weight in kilograms:</p> <input class="weight-input-field" type="text"><br> <button class="calculate"> Calculate</button> </div> <h3 class="result"></h3> <p class="result-statement"></p> not include the html tag or body tag because Squarespace has already them, so it may cause some confilct BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date format) 💫 Animated Buttons (Referral URL) 🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations) 🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment