How to change icon when clicked in list item? (SOLVED)


Hi All.

At first, you can look at my codepen :
I want to create an event :
when user click the (+) button icon at the right, it will immediately change itself to (-) button icon.
And when we click it again, it will be back to (+).

It seems like the changing-icon happened in accordion list :
But i got a problem how to implement that in my case.

is there anyone can show how to create like that?
Any advice would be greatly appreciated!



I didn’t realise I was doing it, but I think I’ve actually just overwritten your codepen with the solution!


Wew. That’s cool!
Great thanks @CT14_IT :wink:

But what if it also can change the icon color?
from green to red (or “balanced” to “assertive” -in Ionic) and vice versa.
Is there any way to create like that?


Yeah, you’ll see that I change the class of the button between ion-plus-circled and ion-minus-circled, you can do the same with button-balanced and button-assertive too (which I’ve now done to the codepen)


Cool! I understand now.
Thanks (again) @CT14_IT !