How do you change video src using jQuery?

前端 未结 8 849
执笔经年
执笔经年 2020-12-12 14:08

How do you change the src of a HTML5 video tag using jQuery?

I got this HTML:

8条回答
  •  情话喂你
    2020-12-12 14:54

    What worked for me was issuing the 'play' command after changing the source. Strangely you cannot use 'play()' through a jQuery instance so you just use getElementByID as follows:

    HTML

    
    

    JAVASCRIPT

    $("#videoplayer").html('' );
    document.getElementById("videoplayer").play();
    

提交回复
热议问题