M4rtin1 Posted May 26, 2021 Share Posted May 26, 2021 Hallo, I want to make a todo list website for practicing, do you know why the JSON.stringify argument doesn't work in the script? The alert says: "eingabe = {}" no matter what I put in the input box. Thanks! document.getElementById("addto").addEventListener("click", addtolist); function addtolist() { var eingabe = document.getElementById('meininput'); var liste = document.getElementById("liste").textContent; alert("eingabe = " + typeof eingabe + " liste = "+ typeof liste + " eingabe = " + eingabe.value + " liste = "+ liste); var eingabestring = JSON.stringify(eingabe); alert("eingabe = " + typeof eingabestring + " liste = "+ typeof liste + " eingabe = " + eingabestring + " liste = "+ liste); eingabestring.write('<br/>'); eingabestring.write(liste); document.getElementById("liste").textContent = eingabe.nodeValue; } Link to comment Share on other sites More sharing options...
Ingolme Posted May 27, 2021 Share Posted May 27, 2021 You're probably looking for the value of the element: var eingabe = document.getElementById('meininput').value; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now