My html code
<form id="form">
<input type="text" class="search" id="search">
<input type="submit" value="Submit" class="submit">
<ul><li id="first"></li></ul>
</form>
My Javascript code
document.getElementById("form").onsubmit = function() {Search()};
var itemListVal = "";
isChanged = false;
function Search() {
let inputValue = document.getElementById("search").value;
document.querySelector("#first").innerText = inputValue;
itemListVal = inputValue;
isChanged = true;
}
I was trying to make the item list which I was gonna make as a search history (I am new to frontend developing so I am not trying to storing yet ig) to change as the last searched thing aka the last submitted but It only changes for a really little bit of time and goes back as it is