From 2b1291816f6ec1d192572b1eb0b2ce45a80dcbd0 Mon Sep 17 00:00:00 2001 From: Matthew McClure Date: Fri, 7 Feb 2014 16:26:49 -0800 Subject: [PATCH 1/2] Update docs to reflect being able to pass an element instead of ID. Closes #844 --- docs/guides/setup.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/guides/setup.md b/docs/guides/setup.md index e148f4ea56..0e765d9480 100644 --- a/docs/guides/setup.md +++ b/docs/guides/setup.md @@ -86,3 +86,11 @@ The second argument is an options object. It allows you to set additional option The third argument is a 'ready' callback. Once Video.js has initialized it will call this function. +videojs(document.getElementsById('example_video_1')), {}, function()) { + // This is functionally the same as the previous example. +}); + +videojs(document.getElementsByClassName('awesome_video_class')[0], {}, function()) { + // You can grab an element by class if you'd like, just make sure + // if it's an array that you pick one (here we chose the first). +}); From 7926c2d9a6e365334c5d55c4928680109c7e0274 Mon Sep 17 00:00:00 2001 From: Matthew McClure Date: Fri, 7 Feb 2014 16:52:15 -0800 Subject: [PATCH 2/2] syntax highlighting and some clarity --- docs/guides/setup.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/guides/setup.md b/docs/guides/setup.md index 0e765d9480..4e6628274c 100644 --- a/docs/guides/setup.md +++ b/docs/guides/setup.md @@ -86,11 +86,17 @@ The second argument is an options object. It allows you to set additional option The third argument is a 'ready' callback. Once Video.js has initialized it will call this function. +Instead of using an element ID, you can also pass a reference to the element itself. + +```js videojs(document.getElementsById('example_video_1')), {}, function()) { // This is functionally the same as the previous example. }); +``` +```js videojs(document.getElementsByClassName('awesome_video_class')[0], {}, function()) { // You can grab an element by class if you'd like, just make sure // if it's an array that you pick one (here we chose the first). }); +```