I'm currently working on developing a "MEME Generator" but I've hit a roadblock at this stage. Whenever I:
upload > Enter Text > Submit
All of the JavaScript changes revert back to the default state. It seems like I might be overlooking something, so any assistance would be greatly appreciated.
function topContent() {
var topText = document.getElementById("userTopText").value;
document.getElementById("topText").innerHTML = topText;
}
function changeImg() {
document.getElementById("frame").style.background = "url(assets/Background.jpg)";
}
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
#frame {
width: 20%;
height: 60%;
color: white;
background-size: 20% 60%;
background-repeat: no-repeat;
}
#frame h1 {
text-align: center;
}
<div id="frame" width="20%" height="60%">
<h1 id="topText"></h1>
</div>
<button onClick="changeImg()">Upload</button>
<form>
<input type="text" id="userTopText">
<button type="submit" onClick="topContent()">Enter</button>
</form>