Interesting way to solve it. But not actually what I need. This way I have to write rules child to .content click.
But the data can be returned in many different ways and blocks not only .content. And this case it's look quiete not flexible and not beautiful :(
I was asking about reloading whole set of rules on ajax execution. Like it's working in event:selectors.
Yehuda told me to try setting click event hadler globally. Now I'm thinking of how to do it



05.11.06, Aloyzas Rimeika <[EMAIL PROTECTED]> написал(а):
$(function(){
    $('.content').load('site.php?page=1start');

    $('.content').click(function(e){
        if ( e.target.id == "loadeddata")
            $(e.target).color('red');
    });

    $(".menu li").click(function() {
        $(".content").load('site.php',{page: $(this).attr('name')}, function(){
            $(this).show("slow");
        });
    });
});



On 11/3/06, Марат < [EMAIL PROTECTED]> wrote:
So, than just take a look waht happens if i comment the line  $(".menu li").unbind('click');   from example

See waht happens: http://127-creative.ru/tmp/jquery/site-jq.html


02.11.06 , Yehuda Katz <[EMAIL PROTECTED]> написал(а):
You don't need to unbind event handlers before reapplying them. jQuery tests whether an event handler is bound to an element before binding it. So you're not going to have doubling or tripling event handlers.

-- Yehuda

On 11/2/06, Марат < [EMAIL PROTECTED]> wrote:
Hi, there!

Is there more effective and beautiful way to reload all rules than that? Or a plugin, or something about that

$(document).ready(function(){
    $('.content').load('site.php?page=start');
    $(function() {
        var addClickHandlers = function() {   
            $(".menu li").click(function() {               
                $(".content").load('site.php',{page: $(this).attr('name')}, function(){
                    $(this).show("slow");       

//below goes discontent

                    $(".menu li").unbind('click');
                    addClickHandlers();
                });               
            });

//#loadeddata is returned by request clicking .menu li  (just looking if rules are reaplied)

            $("#loadeddata").click(function() {$(this).color('red');});           
        };
        addClickHandlers();
    });
});

I don't like this because I have to use callbacks all the time and to unbind events that are doubling, trippling and so on while returning new data and reaplying events

 $(".menu li").unbind('click');
 addClickHandlers();

--
____________________________

С уважением, Марат Мамяшев

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





--
Yehuda Katz
Web Developer | Wycats Designs
(ph)  718.877.1325
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





--
____________________________

С уважением, Марат Мамяшев

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





--
____________________________

С уважением, Марат Мамяшев
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to