0

I keep getting a Object has no method error when trying to call jwplayer's setup method or bootstraps carousel method.

I do have JQuery installed and it works properly, I can also use JS from bootstrap using data-attributes and regular jQuery works just not with these two.

Here is a fiddle http://jsfiddle.net/S9jDw/

I've been stuck with this for days.

this is my js code

$(document).ready(function() {
  jwplayer('.jw-wrapper').setup({
      file: 'http://helpsaverosie.ca/Rosie.m4v',
      image: 'https://www.longtailvideo.com/content/images/jw-player/lWMJeVvV-876.jpg',
      title: 'Rosie',
      width: '100%',
      aspectratio: '16:9',
      mute: 'true',
      autostart: 'true'
  });

});

and this is my html output

<!DOCTYPE html>
<html class='index'>
  <head>
    <title>Save Rosie</title>
    <meta charset='utf-8'>
    <!-- Always force latest IE rendering engine or request Chrome Frame -->
    <meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
    <!-- Use title if it's in the page YAML frontmatter -->
    <link href="/stylesheets/fonts.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/all.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/bootstrap.css" media="screen" rel="stylesheet" type="text/css" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>
    <script src="/javascripts/bootstrap.js" type="text/javascript"></script>
    <script src="http://jwpsrv.com/library/Xp3HoLIEEeOyYSIACmOLpg.js" type="text/javascript"></script>
    <script src="/javascripts/all.js" type="text/javascript"></script>
    <link href='https://s3-us-west-2.amazonaws.com/rosiesdonations/favicon.ico' rel='shortcut icon' type='image/vnd.microsoft.icon'>
    <meta content='width=device-width, initial-scale=1' name='viewport'>
    <script src=''></script>
  </head>
  <body>

    <div class='wrapper'>
      <div id='image-wrapper'>
        <aside class='left-side-image'>
          <img alt='Side Image Left' src='https://s3-us-west-2.amazonaws.com/rosiesdonations/Rosie_Left.gif'>
        </aside>
        <aside class='right-side-image'>
          <img alt='Right Side Image' src='https://s3-us-west-2.amazonaws.com/rosiesdonations/Rosie_Right.png'>
        </aside>
      </div>
      <div class='container'>
        <nav class='row main-header'>
          <header class='col-md-12'>
            <h1>Help Save Rosie</h1>
          </header>
        </nav>
        <section class='row main-body'>
          <div class='col-md-12'>
            <div class='jw-wrapper'></div>
            <div class='carousel slide' data-ride='carousel' id='main-carousel'>
              <div class='carousel-inner'>
                <div class='item active'>
                  <img alt='Rosie Picture one' src='https://s3-us-west-2.amazonaws.com/rosiesdonations/Rosie1.png'>
                </div>
                <div class='item'>
                  <img alt='Rosie Picture two' src='https://s3-us-west-2.amazonaws.com/rosiesdonations/Rosie2.jpg'>
                </div>
                <div class='item'>
                  <img alt='Rosie Picture three' src='https://s3-us-west-2.amazonaws.com/rosiesdonations/Rosie3.jpg'>
                </div>
              </div>
            </div>

        </section>

      </div>
    </div>

  </body>
</html>

1 Answer 1

1

It looks like jwplayer is actually expecting the id of the element and not a selector.

Try changing class="jw-wrapper" to id="jw-wrapper" and change your setup method to:

$(document).ready(function() {
  jwplayer('jw-wrapper').setup({
      file: 'http://helpsaverosie.ca/Rosie.m4v',
      image: 'https://www.longtailvideo.com/content/images/jw-player/lWMJeVvV-876.jpg',
      title: 'Rosie',
      width: '100%',
      aspectratio: '16:9',
      mute: 'true',
      autostart: 'true'
  });

});
Sign up to request clarification or add additional context in comments.

3 Comments

Tried this didn't work either. :( Still same error I think this is more then to do with my code, there is something about how part of my js is integrated in
Strange. I made the changes to the jsFiddle and it's working: jsfiddle.net/S9jDw/2.
Ah i didn't see the removal of the # in the jwplayer method

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.