How to delete an unordered list elements using JavaScript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to delete an unordered list elements using JavaScript?

Delete/strike the values in <li> tags in a web page by just clicking on them using the JavaScript.

18th Feb 2019, 5:40 AM
Abhishek
Abhishek - avatar
3 Answers
+ 6
<ul onclick="document.getElementById(event.target.id).style.textDecoration = 'line-through'"> <li id="list1">HTML</li> <li id="list2">CSS</li> <li id="list3">JavaScript</li> </ul> https://code.sololearn.com/WWrfkrqsF5fe/?ref=app
18th Feb 2019, 6:00 AM
Calviղ
Calviղ - avatar
+ 5
18th Feb 2019, 10:51 AM
Gordon
Gordon - avatar
+ 2
thank you mate.
19th Feb 2019, 2:39 AM
Abhishek
Abhishek - avatar