Pls tell me what's wrong with this code 🙏 | SoloLearn: Learn to code for FREE!

0

Pls tell me what's wrong with this code 🙏

<DOCTYPE html> <html> <head> <title>rubbish</title> <style> html{ background-color: silver; } p{ background-color: color: } </style> </head> <body> <p>Input your value in fahrenheit to convert to degree Celsius</p><br /> <input id="test" /><br /> <button onclick="convert()"> CONVERT </button><br /> <p id="demo"> </p> <script> function convert(f){ return (5 / 9) * (f - 32); } document.getElementById("demo").innerHTML = convert(document.getElementById("test").value) + " is your answer in °C"; </script> </body> </html> Pls copy and paste on your playground, see the output and tell me what I did wrong Help a brother

j's

7/2/2020 10:25:38 AM

Olalekan Babalola

4 Answers

New Answer

0

0

<!DOCTYPE html> Not added !

0

Olalekan Babalola I hope you would understand why <input id="test" /><br /> <button onclick="convert()"> CONVERT </button><br /> <p id="demo"> </p> <script> function convert(){ var f=document.getElementById('test').value; document.getElementById("demo").innerHTML= ((5 / 9) * (f - 32)) + " is your answer in °C"; } </script>

0

Yeah I understand Thanks Rithea Sreng it works