hotsauce wrote:

: I keep receiving an error with this bit of code on click
: 
:  $(document).ready(function() {
:    $('div.example').click( function() {
:       $(this).toggleClass("activated");
:    });
:  });
: 
: It works, but I keep receiving an error stating that
: "toggleClass is not defined"
:
: How would I define this?

    toggleClass is defined in jQuery. If it is not defined, you
have not loaded the jQuery library or you are using a version
which does not have that function. Check your path to the
library in your meta tags.

    Otherwise, present a complete example (html and code) which
raises the same error you are receiving. In my tests (v1.2.2), I
could not reproduce your error.

<html>
<head>
    <title>Foo</title>
    <script type="text/javascript"
src="/site/code/jquery-1.2.2.pack.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('div.example').click( function() {
                $(this).toggleClass('activated');
            });
        });
    </script>
    <style type="text/css">
        .example { background-color: #ffffcc; }
        .activated { background-color: #ffffff; }
    </style>
</head>
<body>
    <div class="example">Example</div>
</body>
</html>


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/

Reply via email to