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>