'Javascript node list looping not working as it should

I believe that my initial question was not clear as to what I was trying to accomplish. I was newer and I was trying to figure out how exactly I was to use a javascript loop in order to loop through certain elements to remove them. It's a simple task, but, as a beginner, you're not going to really necessarily know what it is that you need to do without studying the documentation.

I have provided a sample finished code that demonstrates removing the different paragraph items using e.target. I was not able to get e.target.innerHTML to work, however, e.target worked just fine.

let para = document.querySelectorAll('p'); 
for (i = 0; i < para.length; i++){
para[i].addEventListener('click', (e)=> {
let target = e.target; 
target.style.display="none"; }, false); 
}
<p>Para 1</p>
<p>Para 2</p>
<p>Para 3</p>


Solution 1:[1]

Yayyy!!!! After a fun breakthrough session, I've figured out what the heck that I was doing wrong. I misunderstood where to put the index. I also misunderstood how to apply the Switch statement. I've found a means to apply the Switch statements and then let them go through until the end so that way the carousel that I'm working won't be broken. Finally.

As far as the broken code, it just took a lot of experimenting, and, sometimes, I'm not honestly sure why it wasn't working. But, I did it from scratch. I figured that something previously in the code was making it not work and I took it out and added newer code in and it works. I'll definitely clean up my CSS now.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user129963