jQuery issue - # has no method

后端 未结 6 1987
长发绾君心
长发绾君心 2020-12-17 07:35

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


(source: shaunbellis.co.uk)

… regardless of what plugin I

相关标签:
6条回答
  • 2020-12-17 08:14

    Ignore me. I'm sorry everyone. I'd mistyped the url of the script. Thanks to Simon Ainley for the prod in the right direction.

    Sorry again. Thanks.

    0 讨论(0)
  • 2020-12-17 08:20

    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!

    0 讨论(0)
  • 2020-12-17 08:25

    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.

    0 讨论(0)
  • 2020-12-17 08:27

    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!

    0 讨论(0)
  • 2020-12-17 08:28

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

    0 讨论(0)
  • 2020-12-17 08:38

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

    0 讨论(0)
提交回复
热议问题