DEV Community

bdarab
bdarab

Posted on

Having problem targeting the text inside li

I am having a problem to find a selector for the text inside my "li" to target with JavaScript. The problem is that I have a nested "span" element with two icons in my "li". That gives me a problem just to "li" to target it, since, it also covers the "span" with icons. What I am trying to do is add {text-decoration: 'line-through'} when the 'check' icon is clicked. and remove the text, when 'trash'icon is clicked. As I said, my problem is targeting the text within the "li" .

Top comments (4)

Collapse
 
bdarab profile image
bdarab

Here is a screenshot of my app.js

Collapse
 
rafaelrozon profile image
Rafael Rozon

Hey @bdara, if you share the snippet of the code ( it doesn't need to be everything, just the HTML), I think I can help you. Maybe codesandbox.io/ is a good choice. Or anything that works for you.

Collapse
 
bdarab profile image
bdarab

Thanks for your interest. But, I got tired of trying to fix this code & made radical changes in my HTML and JS codes. Starting afresh.
Thanks again

Collapse
 
bdarab profile image
bdarab