My degrees converter code is functioning well, but I have an issue. When I input a number for one temperature type, the conversion for the other two types is displayed correctly. However, if I then enter a number for another temperature type, the previous value remains in the Kelvin input box. Ideally, I want the previously displayed value to disappear when a new temperature type is selected. I've attempted using "document.getElementById("").style.display = "none"; but this only removes the input box itself. Is there a way to make just the text disappear while keeping the input box visible?
if(temperature == "Fahrenheit") {
calculate = Math.round((inputValue - 32) * 0.555);
document.getElementById("Celsius").value = calculate;
calculate = Math.round((inputValue - 32) * 0.555 + 273.15);
document.getElementById("Kelvin").value = calculate;
// hide fahrenheit value
}
else if(temperature == "Celsius") {
calculate = Math.round((inputValue * 0.555) + 32);
document.getElementById("Fahrenheit").value = calculate;
calculate = Math.round(inputValue + 273.15);
document.getElementById("Kelvin").value = calculate;
// hide celsius value
}
If my explanation isn't clear, let me know and I can provide more details.