jquery - is not a function error

0 votes

Here is my code:

(function($){
    $.fn.pluginbutton = function (options) {
        myoptions = $.extend({ left: true });
        return this.each(function () {
            var focus = false;
            if (focus === false) {
                this.hover(function () {
                    this.animate({ backgroundPosition: "0 -30px" }, { duration: 0 });
                    this.removeClass('VBfocus').addClass('VBHover');
                }, function () {
                    this.animate({ backgroundPosition: "0 0" }, { duration: 0 });
                    this.removeClass('VBfocus').removeClass('VBHover');
                });
            }
            this.mousedown(function () {
                focus = true
                this.animate({ backgroundPosition: "0 30px" }, { duration: 0 });
                this.addClass('VBfocus').removeClass('VBHover');
            }, function () {
                focus = false;
                this.animate({ backgroundPosition: "0 0" }, { duration: 0 });
                this.removeClass('VBfocus').addClass('VBHover');
            });
        });
    }
});


$(document).ready(function () {
    $('.smallTabsHeader a').pluginbutton();
});

It gives me an error. What's wrong?

Aug 3, 2022 in Web Development by gaurav
• 23,260 points
728 views

1 answer to this question.

0 votes

In Wordpress jQuery.noConflict() is called on the jQuery file it includes (scroll to the bottom of the file it's including for jQuery to see this), which means $ doesn't work, but jQuery does, so your code should look like this:

<script type="text/javascript">
  jQuery(function($) {
    for(var i=0; i <= 20; i++) 
      $("ol li:nth-child(" + i + ")").addClass('olli' + i);
  });
</script>
answered Aug 4, 2022 by rajatha
• 7,680 points

Related Questions In Web Development

0 votes
0 answers

jQuery(...).iris is not a function

I am trying to implement color picker ...READ MORE

Jul 28, 2022 in Web Development by gaurav
• 23,260 points
659 views
0 votes
0 answers

TypeError: this.client.incrementMaxListeners is not a function

I'm making a command for my discord ...READ MORE

Dec 29, 2020 in Web Development by anonymous
• 120 points
824 views
0 votes
1 answer

Error: Failed to load resource: the server responded with a status of 404 (Not Found)

Your files are not under the JSP folder that's ...READ MORE

answered Dec 16, 2020 in Web Development by Gitika
• 65,770 points
88,067 views
0 votes
1 answer

jQuery Load function not loading the file

The jQuery load() method allows HTML or ...READ MORE

answered Jun 29, 2022 in Web Development by rajatha
• 7,680 points
3,852 views
0 votes
1 answer

jQuery 'if .change() or .keyup()'

you can bind to multiple events by ...READ MORE

answered Jun 20, 2022 in JQuery by rajatha
• 7,680 points
2,699 views
0 votes
1 answer

jquery function setInterval

This is because you are executing the ...READ MORE

answered Jun 20, 2022 in JQuery by rajatha
• 7,680 points
2,322 views
0 votes
0 answers

Jquery Masonary and item filtering does not work together

I am using a small js filter ...READ MORE

Jul 25, 2022 in Web Development by gaurav
• 23,260 points
624 views
0 votes
2 answers

How can we pass a function as a parameter in java?

Java 8 and above Using Java 8+ lambda ...READ MORE

answered Aug 28, 2018 in Java by Daisy
• 8,140 points
1,614 views
0 votes
1 answer

toaster.clear('*') does not work inside a jQuery function

The error - "TypeError: $.toast is not a ...READ MORE

answered Aug 5, 2022 in Web Development by rajatha
• 7,680 points
4,170 views
0 votes
1 answer

Loading gif in jQuery ajax call is not showing

Create a div with your image. Make it ...READ MORE

answered Jun 27, 2022 in Web Development by rajatha
• 7,680 points
1,730 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP