'Jquery function not working to all buttons

i am trying to make an click function where buttons are same class name. problem is when i click the first accordion-button my code is working but not for all accordion-buttons heres the code

 $('.accordion-button').on('click',function(){
  if($('.accordion-button').attr('aria-expanded') === "true"){
    $(this).find('.featherIcon').addClass('active');
    console.log('Clicked');
    
  } 
 else if($('.accordion-button').attr('aria-expanded') === "false"){
    $('.featherIcon').removeClass('active');
    console.log('false');
  } 
}); 


Sources

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

Source: Stack Overflow

Solution Source