0
For loop doesn't stop
Why when I click the element li why confirm it appeared repeatedly? https://code.sololearn.com/WyvHCv6EVkLj/?ref=app Note: insert the text with click edit and then type a word and then enter on your keyboard and then repeat doing that min 2 time and try to click li for delete the data.
4 Respostas
+ 1
do a check before ask for confirmation.
check if the element triggering the event is "kosong" or not. if not then continue with the confimation
edit: i just see the updated question, doesnt seems like my asnwer is correct
edit2: i see the problem. your code keep adding a new listener on every input. thus all of the listener that are registered got triggered. try to limit the add listener to one. or use onclick = instead of addEventListener
0
Taste so how can this no be happening ?
0
see my updated answer
0
Taste thanks it's solve now