如何更改 <i class"material-icons> 的内容,因为它是 <p>

how to change content of <i class"material-icons> as it was a <p>

我正在尝试使用 google 图标字体更改音频按钮,但 innerHTML 仅适用于段落 您如何在 javascript 中编写代码?

if(aud1){
        document.getElementById("play1").addEventListener("click",
            function(){
                if(aud1.paused){
                    aud1.play();
                    document.getElementById("play1").innerHTML = <i class="material-icons">play_arrow</i>;}
                else{
                    aud1.pause();
                    document.getElementById("play1").innerHTML = <i class="material-icons">pause</i>;}

为您的标签分配 ID

<i id="icon" class="material-icons">play_arrow</i>

然后更改标签的内部HTML

if(aud1){
    document.getElementById("play1").addEventListener("click",
        function(){
            if(aud1.paused){
                aud1.play();
                document.getElementById("icon").innerHTML ="play_arrow";}
            else{
                aud1.pause();
                document.getElementById("icon").innerHTML ="pause";
            }
        );