hi there! 👋
Maybe it's just me (I s*ck at reading others code), but I don't see where you are trying to toggle either of the icons in your code. You are toggling a class to the 'p' element using the addEventListener
method, but you are not toggling the icons themselves.
You can try to add these to your eventListener
:
plusIcon[index].style.display = 'none';
minusIcon[index].style.display= 'inline';
where minusIcon is (surprise) the minus icon which closing the tabs.
Then you should also add another eventListener
to minus icon to reverse the whole thing.
Or you can check my solution, but I used jQuery to complete it.
Hope this helped, Good luck and happy coding!
Marked as helpful
@FlackoCodes
Posted
Hello @kodan96 I did exactly (added another event listener for the icon-minus) just that and it worked for me.
Thanks man.