Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to change icon from play to pause in javascript

<script>
    function toggleSound() {
       var audioElem = document.getElementById('player');
       if (audioElem.paused) {
          audioElem.className = "fa fa-play";
          audioElem.play();
       } else {
          audioElem.className = "fa fa-pause";
          audioElem.pause();
       }
    }
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #change #icon #play #pause #javascript
ADD COMMENT
Topic
Name
9+6 =