Search code examples
jqueryversions

toggle() not working in jQuery 1.10.2


Why isn't this code working with jQuery 1.10.2, but with 1.8.3? Are there probably any minor changes to fix it?

$(document).ready(function(){
    $(".mob-nav-overlay").hide();
    $(".mob-nav-button").show(); 
    $('.mob-nav-button').toggle(function() {
        $("#mob-nav-close").html("x");
        $(".mob-nav-overlay").fadeIn("fast");
    })},
    function() {
        $("#mob-nav-close").text("#");
        $(".mob-nav-overlay").fadeOut("fast");
    })
});

Thanks a lot! Paul


Solution

  • The .toggle() event was deprecated in jQuery 1.8 and removed in jQuery 1.9.

    See http://api.jquery.com/toggle-event/