I have an accordion that can expand collapse. I set up some FontAwesome icons to help illustrate when it's open and closed - however, I can't seem to get it to change icons.
I was basing this knowledge off other StackOverflow posts that I saw - but for some reason I can't seem to get mine to work. If I had to guess I'm definitely missing the ball with jQuery. I struggle there, so I'm assuming I'm not selecting the right element.
I put just the chunk of code for the accordion into a JSFiddle: https://jsfiddle.net/ehkv99h9/18/
$(this).find($(".fa")).removeClass('fa-caret-right').addClass('fa-caret-down');
is what I think is tripping me up (as seen line 14 in my jsfiddle - I commented out for now since it wasn't working)
I tried writing some stuff to console.log
to help determine if I was selecting the right part in my code, but I couldn't figure it out unfortunately.
What would I need to change in order to get my caret to rotate to the down position when it expands?
(One note: I have a few arrows there, I was testing out different icons, but I think it would be the same "fa-caret-right"/"fa-caret-down" vs. "fa-angle-right"/"fa-caret-down").