开发者

jquery ajax call and hide function

开发者 https://www.devze.com 2023-03-26 11:44 出处:网络
I have the following scr开发者_运维百科ipt that works ok on the first page load. I am then calling a page again and the hide function does not work, and certain formatting is lost..

I have the following scr开发者_运维百科ipt that works ok on the first page load. I am then calling a page again and the hide function does not work, and certain formatting is lost..

Any ideas. Is there a way using jquery live or delegate for instance.

$(document).ready( function() {

    // Hide all subfolders at startup
    $(".php-file-tree").find("UL").hide();

    // Expand/collapse on click
    $(".pft-directory A").click( function() {
        $(this).parent().find("UL:first").slideToggle("medium");
        if( $(this).parent().attr('className') == "pft-directory" ) return false;
    });

});

How do I execute find("UL").hide(); again on ajax call.


In the ajax success handler just execute the below line

$(".php-file-tree").find("UL").hide();
0

精彩评论

暂无评论...
验证码 换一张
取 消