I tried every lines of code I could think of but it didn’t work. I’m stuck on these for like a week now.
let button = document.querySelector("convert");
let celsius = document.querySelector("temp_celsius");
let fahrenheit = document.querySelector("temp_fahr");
button.onclick = function celsiusToFahrenheit(celsius){
var fahrenheit = (9 * celsius / 5) + 32;
return fahrenheit;
};
document.getElementById("temp_celsius").innerHTML = celsius;
document.getElementById("convert").onclick = button;
document.getElementById("temp_fahr").value;
// "temp_celsius" - id of celsius div
// "convert" - id of calculate div
// "temp_fahr" - id of fahrenheit div
/* function celsiusToFahrenheit(celsius){
var fahrenheit = (9 * celsius / 5) + 32;
return fahrenheit;
}; - function to convert Celsius to Fahrenheit made on exercise #2 */