+ 1
I want to make a calculation form where you would input numbers and when you click calculate and it will calculate the result
<label>Feet</label> <input id="x" type="number" placeholder="Feet" required> <label>final</label> <input id="y" type="number" placeholder="..." disabled> <p> will calc<span div I’d="cal"></span> </p> <button onclick="f()"> calculate </button> <script> var x = 2; var y = 5; function f() { document.getElementById("cal").innerHTML = x + y; } </script>
2 Antworten
+ 1
Neato! :) Post it up to us when you're done and we'll check it out + give you feedback on it.
Btw, in your current version of the code, it should be id="cal" instead of div="cal" - just something I noticed at first glance. ;) (also, don't forget to put your JS inside of <script> tags or place it inside of JS tab)
Best of luck to ya!
If you run into any problems or have questions, don't hesitate to ask us. We'll get you pointed in right direction.
+ 1
It’s in external style script