Jquery 在单击元素时切换音频?

Jquery 在单击元素时切换音频?,jquery,audio,click,toggle,Jquery,Audio,Click,Toggle,如何在单击单个元素时切换音频 请看小提琴 这是为了播放/暂停歌曲: HTML: <div id="one" class="bar1"> <i class="play">I tried to tell you</i> <i class="stop">I tried to tell you</i> </div> JS: <div id="one" class="bar1"> <i c

如何在单击单个元素时切换音频

请看小提琴


这是为了播放/暂停歌曲:

HTML:

<div id="one" class="bar1">
    <i class="play">I tried to tell you</i>
    <i class="stop">I tried to tell you</i>
</div>
JS:

<div id="one" class="bar1">
    <i class="play">I tried to tell you</i>
    <i class="stop">I tried to tell you</i>
</div>
.stop{
    display:none;
}
$("#one").click(function () {
    if ($('#sound-1').get(0).paused == false) {
        $('#sound-1').get(0).pause();
        alert('music paused');
    } else {
        $('#sound-1').get(0).play();
        alert('music playing');
    }
    $('i').toggle();
});