I would like to change the arrow style on click.
When the accordion is closed, the arrow is down. When the user clicks the down arrow the accordion will open and the arrow will turn point up.
<button type="button" class="btn btn-warning btn-sm " onclick="changeToggle(this)"><i class="fa fa-arrow-down" ></i></button>
function changeToggle(btn) {
$(btn).closest("tr").next().toggle();
$(btn).removeClass('fa-arrow-down').addClass('fa-arrow-up');
}
Normally in jQuery, if i know the id of the parent item I could use $("#id i")
but because I used this
as a parameter in the code.
I'm not sure how I can access the inside the button to change arrow style.