[javascript] jQuery issue - #<an Object> has no method

I've tried a veriety of jQuery plugins recently and I keep getting this error …

has no method
(source: shaunbellis.co.uk)

… regardless of what plugin I try to use.

I've checked the links to the JS files which are all there and working fine. I'm using Drupal if that makes any difference.

I've run the plugins away from the main site to demonstrate that they are working and that I am doing things right with 100% success.

Any ideas?

Update:

My jQuery file called in the footer:

$(document).ready(function() {          

$('#footer_holder').hide();

// Fancy Box
$("a.fancybox").fancybox({
    'hideOnContentClick': true,
    'titlePosition' : 'over',
    'transitionIn'  :   'elastic',
    'transitionOut' :   'elastic',
    'speedIn'       :   600, 
    'speedOut'      :   200, 
    'overlayShow'   :   false,
});

$("#homepage_slider").easySlider({
    auto: true, 
    continuous: true,
});

});

*note - fancy box works fine (unless the easySlider code is above it). jQuery is sorted out by Drupal. I'm running version 1.4

This question is related to javascript jquery drupal slider

The answer is


This problem can also arise if you include jQuery more than once.


This usually has to do with a selector not being used properly. Check and make sure that you are using the jQuery selectors like intended. For example I had this problem when creating a click method:

$("[editButton]").click(function () {
    this.css("color", "red");
});

Because I was not using the correct selector method $(this) for jQuery it gave me the same error.

So simply enough, check your selectors!


For anyone else arriving at this question:

I was performing the most simple jQuery, trying to hide an element:

('#fileselection').hide();

and I was getting the same type of error, "Uncaught TypeError: Object #fileselection has no method 'hide'

Of course, now it is obvious, but I just left off the jQuery indicator '$'. The code should have been:

$('#fileselection').hide();

This fixes the no-brainer problem. I hope this helps someone save a few minutes debugging!


This problem may also come up if you include different versions of jQuery.


I had this problem, or one that looked superficially similar, yesterday. It turned out that I wasn't being careful when mixing jQuery and prototype. I found several solutions at http://docs.jquery.com/Using_jQuery_with_Other_Libraries. I opted for

var $j = jQuery.noConflict();

but there are other reasonable options described there.


Examples related to javascript

need to add a class to an element How to make a variable accessible outside a function? Hide Signs that Meteor.js was Used How to create a showdown.js markdown extension Please help me convert this script to a simple image slider Highlight Anchor Links when user manually scrolls? Summing radio input values How to execute an action before close metro app WinJS javascript, for loop defines a dynamic variable name Getting all files in directory with ajax

Examples related to jquery

How to make a variable accessible outside a function? Jquery assiging class to th in a table Please help me convert this script to a simple image slider Highlight Anchor Links when user manually scrolls? Getting all files in directory with ajax Bootstrap 4 multiselect dropdown Cross-Origin Read Blocking (CORB) bootstrap 4 file input doesn't show the file name Jquery AJAX: No 'Access-Control-Allow-Origin' header is present on the requested resource how to remove json object key and value.?

Examples related to drupal

How do I solve this "Cannot read property 'appendChild' of null" error? How to output (to a log) a multi-level array in a format that is human-readable? FPDF error: Some data has already been output, can't send PDF How can I check Drupal log files? what is the difference between $_SERVER['REQUEST_URI'] and $_GET['q']? jQuery issue - #<an Object> has no method How to get the full URL of a Drupal page? CSS to hide INPUT BUTTON value text

Examples related to slider

Change the Arrow buttons in Slick slider Touch move getting stuck Ignored attempt to cancel a touchmove Carousel with Thumbnails in Bootstrap 3.0 Very Simple Image Slider/Slideshow with left and right button. No autoplay Implementing a slider (SeekBar) in Android HTML5: Slider with two inputs possible? jQuery issue - #<an Object> has no method How to change Jquery UI Slider handle Is there a simple JavaScript slider?