Jquery toggle function that doesn't return false?

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-03-13T06:43:27Z Indexed on 2010/03/13 6:55 UTC
Read the original article Hit count: 237

Filed under:
|
|
|

Hi,

Is it possible to stop the automatic preventDefault() from applying in a simple Jquery toggle function?

$(".mydiv").toggle(
    function () {
        $(this).addClass("blue");
    },
    function () {
        $(this).removeClass("blue");
    }
);

The above prevents elements inside the div from responding normally to the click.

It doesn't have to be the toggle() function - anything that allows toggling a class on and off AND doesn't return false would be great.

Thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about toggle