Answers for "how to use toggle class for font awesome"

1

toggle font awesome icon

<!-- HTML -->
    <button class="btn btn-warning">
      <i id="tgl" class="fas fa-star"></i>
    </button>
<!--  -->

<script>
      $('button').click(function () {
        $('#tgl').toggleClass('fa-star fa-grin-stars');
      });  
</script>
Posted by: Guest on July-02-2021

Code answers related to "how to use toggle class for font awesome"

Browse Popular Code Answers by Language