Answers for "toggle font awesome icon"

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

Browse Popular Code Answers by Language