I want to implement this feature where say a meter is included and basically depending on the option you choose, it fluctuates. So if one goes east and ends up at a store, the meter is say, 30% full. But if they goes west, the meter is like 20%. How would I be able to incorporate an HTML feature into my JavaScript code? Is there a way where I can solely write HTML in there without disrupting the JavaScript code>
I tried doing and then adding a var called meter with a document.getElementById ending in .innerHTML but that didn't seem to work.
Here's the code for west, which doesn't have any other options to choose from as of right now:
JavaScript
else if (newInput == "West") {
textInput = "You went to the abandoned neighborhood";
//state = "sites"
document.getElementById("message").innerHTML = textInput;
}
And here's the HTML for the meter that I'd like altered:
<p align = "center" id = "meter">
<font color = "red">
<b>Awareness:<progress value = "0" max = "100"></b>
</font>
</p>
Thank you for the response!