简体   繁体   English

jQuery ajax调用和隐藏功能

[英]jquery ajax call and hide function

I have the following script 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.. 然后,我再次调用页面,并且hide函数不起作用,并且某些格式丢失了。

Any ideas. 有任何想法吗。 Is there a way using jquery live or delegate for instance. 有没有一种方法可以使用实时或委托jQuery。

$(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(); 如何执行find("UL").hide(); again on ajax call. 再次在ajax电话。

在ajax成功处理程序中,只需执行以下行

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM