treehouse : what would you like to learn today?
Web Design Web Development iOS Development

jquery afrer ajax .load use jquery on text

  • Hi.
    I would like to load a page with jquery .load, and then do some changes on loaded page with some jquery functions.
    so it will look like this:
    $(\"#tempcont\").load(target, function() {
    $(\"#center-inner .maincontent\").css('display', 'none');
    $(\"#center-inner .maincontent\").fadeIn();
    });

    But i need to do the same thing in other places (do the stuff on loaded content), so I was wondering, maybe i will make a function:
    $.fn.doactions = function() {
    $(\"#center-inner .maincontent\").css('display', 'none');
    $(\"#center-inner .maincontent\").fadeIn();
    });
    }

    and then call it when i need it:
    $.doaction;

    but it seems not to work (i got no errors, but actions are not working).

    Where is the error?

    Thanks in advice.