ecline6
ecline6

Reputation: 896

JQuery UI craziness

I am surely missing something easy as I am a relative noob at this. Help is appreciated! I am trying to get anything from the JQuery UI to work and nothing will. JQuery and JQuery UI both load without errors. But I can't seem to use any JQuery UI method successfully. Here's the loads from the head of the page:

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js'></script>

Here's a jsfiddle as an example where I'm just trying to toggle a class on mouseenter. http://jsfiddle.net/8WTaW/1/ What is wrong? Thanks!

Upvotes: 1

Views: 80

Answers (2)

Zmart
Zmart

Reputation: 1183

You need to capitalize the 'c' in 'toggleclass' in your code. Javascript is a case-sensitive language, and thus the proper method invocation will be 'toggleClass':

$(function () {
    $('.navs').mouseenter(function () {
        $(this).toggleClass('navshover');
    });
});

http://api.jquery.com/toggleClass/

Upvotes: 3

j08691
j08691

Reputation: 207901

Capital "C".

It's

$(this).toggleClass('navshover');

not

$(this).toggleclass('navshover');

jsFiddle example

(and note, you don't need jQueryUI for this particular example.)

Upvotes: 2

Related Questions