My goal is for the user to be able to enter a block of text and have it returned in a user-friendly format, like a blog post. They'll enter in their name and whatever they want to say, then it will be stored locally and displayed. I've tried storing the data as local storage, but I keep getting an error with "this file does not exist". The code snippet below is just for a basic displaying once the user clicks a button, but even that doesn't work.
Please note this all needs to be able to function independently, as I'm teaching myself basic Javascript/HTML for a coding competition where the only software allowed is notepad for coding and Photoshop for image manipulation.
<!DOCTYPE html>
<html>
<script>
function passvalues() {
var firstName = document.getElementById("txt".value);
localStorage.setItem("textvalue",firstName);
}
document.getElementById("result").innerHTML = localStorage.getItem("textvalue");
</script>
<body>
<form>
<input type = "text" id ="txt" placeholder='place text here'/>
<button type="submit" value='click me!' onClick="passvalues();"> Click Me</button>
</form>
</body>
<p id="result"></p>
</html>
Hi everyone, I'm sorry I didn't get to this sooner! In any case, thank you to all of those who answered, it's highly appreciated.
<p id="result"></p>is outside the body