Skip to content

Instantly share code, notes, and snippets.

@gerbenvandijk
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerbenvandijk/dbb881b56fd22b5f2482 to your computer and use it in GitHub Desktop.
Save gerbenvandijk/dbb881b56fd22b5f2482 to your computer and use it in GitHub Desktop.
Initiate play event on click
// jQuery version - we use the .on() function to make sure we can also run the function on dynamically inserted elements.
$(document).on("click", "a.playbtn", function (e) {
var video = $(document).find('#intro-video')[0]; // Find the video element to play
video.play(); // play the video, simple innit?
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment