LoginSignup
2
2

More than 5 years have passed since last update.

video要素のloadメソッドをjQueryで操作

Posted at

今まで、video要素のloadメソッドを以下のように書いていました。(jQueryを使用しています)

$(function(){
  $("#video要素のID").attr("src", "videoファイルへのパス");
  $("#video要素のID").load();
}

jQueryの3系だとloadが使用できないので、以下のように書き換え。

$(function(){
  $("#video要素のID").attr("src", "videoファイルへのパス");
  $("#video要素のID").trigger("load");
}

jQuery1系からtriggerは使えるので、この方法で統一したほうが良いかも。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2