6
rated 0 times
[
7]
[
1]
/ answers: 1 / hits: 28463
/ 6 Years ago, fri, december 14, 2018, 12:00:00
I was trying to make a list where the user can add his or her favorites. But then I got a maximum call stack size exceeded error.
What is that and how do I fix it?
I'd appreciate the help, thank youuu
Here are the codes that I used:
<body onload=onload();>
<!--for everything in the navigation part including the add favorite bar-->
<div class=topnav>
<!--links to the other pages-->
<a class=active href=home.html>Home</a>
<a href=games.html>Games</a>
<a href=movies.html>Movies</a>
<a href=series.html>TV Series</a>
<a href=books.html>Books</a>
<!--for the add favorite button-->
<div class=addFave>
<!--the text bar-->
<input type=text name=enter class=enter value= id=added placeholder= Add Favorites/>
<!--the enter button-->
<input type=button value=Enter id = addIt OnClick=adding() />
<!--for the script of the add favorite bar to add its functions-->
<script type=text/javascript>
var faves = [];
var y = document.getElementById(added);
function adding() {
faves.push(y.value);
document.getElementById(faveLists).innerHTML = faves;
}
var input = document.getElementById(added);
input.addEventListener(keyup, function(event) {
event.preventDefault();
if (event.keyCode === 13) {
document.getElementById(addIt).click();
}
});
</script>
</div>
</div>
<!--for the additional texts-->
<div class=list>
<!--where the user input in the add favorite bar will appear-->
<p id = faveLists></p>
</div>
</body>
</html>
More From » javascript