I've got a problem.
let liList = document.getElementsByTagName("li");
console.log(liList[1].innerText);
ul {
width: 60%;
margin: auto;
box-sizing: border-box;
padding: 0;
}
li {
list-style-type: none;
padding: 10px;
padding-left: 35px;
position: relative;
}
ul li {
background-color: rgb(226, 226, 226);
}
ul li:nth-child(odd) {
background-color: rgb(245, 245, 245);
}
ul li:hover {
background-color: rgb(192, 192, 192);
cursor: pointer;
}
li.cekirano::before {
border-color: #fff;
border-style: solid;
border-width: 0 2px 2px 0;
content: '';
top: 10px;
left: 16px;
height: 15px;
width: 7px;
position: absolute;
transform: rotate(45deg);
}
li.cekirano {
background-color: rgb(97, 97, 97);
color: white;
text-decoration: line-through;
}
span {
padding: 5px;
position: absolute;
right: 5px;
text-transform: none;
top: 5px;
bottom: 5px;
}
<ul>
<li>Hit the gym<span>×</span></li>
<li>Pay bills<span>×</span></li>
<li>Meet George<span>×</span></li>
<li>Buy eggs<span>×</span></li>
<li>Read a book<span>×</span></li>
<li>Organize<span>×</span></li>
</ul>
But there's an error when I run it into a internet browser: Uncaught TypeError: Cannot read properties of undefined (reading 'innerText') at script.js:2:26
I'm trying to make a to-do list like this on my own. I looked how they did it, and I did similar thing with their code and it gives me good result. Thank you in advance, N.P.