Home>
Why don't I see the characters I typed when there are no errors?
I would appreciate it if you could teach me.
Code let button = document.querySelector ('.btn');
button.addEventListener ('click', function () {
let input = document.querySelector ('.input');
input.value =='';
if (input.value =='') {
let stop_list = document.querySelector ('.stop-list');
let li_stop = document.createElement ('li');
li_stop.classList.add ('list');
li_stop.textContent = input;
console.log (li_stop);
let div_delete = document.createElement ('div');
div_delete.classList.add ('delete')
div_delete ='Delete';
div_delete.addEventListener ('click', function () {
let hantei = confirm ('Are you sure I want to delete?');
this.parentElement.remove ();
li_stop.appendChild (div_delete);
stop_list.appendChild (li);
document.querySelector ('.input'). value ='';
})
}
})
Code<body>
<header>
STOP DOING LIST
<form>
<input type = "text" placeholder = "Add your list here">
<Input type = "button" value = "Add">
</form>
<script src ='todo.js'></script>
</header>
</body>
-
Answer # 1
-
Answer # 2
if (input.value =='') {
So it looks like nothing is done only when the input value is empty.
Also, I can't find the stop-list class in the if
Related articles
- javascript - when i display the value entered in the form, it is displayed as undefined
- javascript - to play the video corresponding to the entered characters
- javascript - i want to write a code that is displayed while the characters change
- javascript - i want to eliminate the full calender not being displayed when deploying on aws
- python - i want to get the characters displayed in a cell with openpyxl
- javascript - the "logped out" notification is also displayed when opening the web app
- i want to run the page displayed by google search with javascript i made
- javascript - i want the characters contained in a variable to have the meaning of an array
- # if you change the value once entered with the score input function with javascript, it will become nan
- i'm making a typing game with javascript, but i don't see the following characters after typing
- javascript - i want to make an implementation that changes characters in roulette format
- javascript - ui change when full screen is displayed with video tag
- javascript - google map is not displayed in production environment
- javascript - i want to display it softly and switch characters
- javascript - i want to make it a specification that characters appear randomly just by pushing i'm getting an error
- javascript - chrome extension if "/" is entered in hostequals, it will not work
- i want to replace characters with javascript and output
- javascript - the pdf file acquired by cannot be displayed by filereader
- javascript - i want to automatically break characters according to the width of the image with css || js
Trends
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
I think the code indentation should be properly arranged.
On top of that