Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught TypeError: Object #<Object> has no method 'movingBoxes'

Im trying to use the movingBoxes plugin with my asp.net mvc site and it is not working (obviously). I have the movingboxes.js imported in my head tag in the site.master like so

    <script src="<%: Url.Content("~/Scripts/jquery.movingboxes.js")%>" type="text/javascript"></script> 

and the browser successfully gets this script. Now i have a regular view that inherits from the site.master that has this little bit of jquery in it that calls the movingBoxes plugin

<script type="text/javascript">     $(document).ready(function () {         $($('#slider-one'));         $('#slider-one').movingBoxes({             startPanel: 1,                   panelWidth: .5,                  fixedHeight: false         });          $('#slider-two').movingBoxes({             startPanel: 1,                  panelWidth: .5,                  fixedHeight: false         });     }); </script> 

When i view the page. Every thing works fine (including other jquery stuff) except for this plugin and i get this error

enter image description here

And here is the description of the error enter image description here

Any help would be appreciated

EDIT

So apparently I had this:

    <script type="text/javascript" src="../../Scripts/jquery-1.4.1.js" />     <script src="<%: Url.Content("~/Scripts/jquery.movingboxes.js")%>" type="text/javascript"></script> 

And it works now by changing it to this:

    <script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script>     <script src="<%: Url.Content("~/Scripts/jquery.movingboxes.js")%>" type="text/javascript"></script> 
like image 203
Collin O'Connor Avatar asked Mar 18 '11 17:03

Collin O'Connor


People also ask

What is an uncaught TypeError?

Educative Answers Team. According to the Mozilla website for developer documents, “the TypeError object represents an error when a value is not of the expected type.” Uncaught means that the error was not caught in the catch part of the try-catch block.

What is JavaScript TypeError?

The TypeError object represents an error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type. A TypeError may be thrown when: an operand or argument passed to a function is incompatible with the type expected by that operator or function; or.


1 Answers

There are a few things you can try to get this working.

  1. Be ABSOLUTELY sure your script is being pulled into the page, one way to check is by using the 'sources' tab in the Chrome Debugger and searching for the file.

  2. Be sure that you've included the script after you've included jQuery, as it is most certainly dependant upon that.

Other than that, I checked out the API and you're definitely doing everything right as far as I can see. Best of luck friend!

EDIT: Ensure you close your script tag. There's an answer below that points to that being the solution.

like image 116
Hacknightly Avatar answered Sep 30 '22 08:09

Hacknightly