I was trying to do a very simple image-swap effect:

<div id="foo">
<p><img ... /></p>
</div>

<div id="bar">
<p><img ... /></p>
</div>

$('foo').observe('click',function(evt){
        $('bar').update(this.down('p'));
});

I expected both #foo and #bar to contain the same image, but instead, #foo was empty, and #bar contained the image originally in #foo.

I resolve the problem by changing my method from copying the P to simply making the two images have the same src attribute.

But can anyone explain what my conceptual failure was here? Why did update() seem to do what I would have expected the following construction to do:

$('bar').update(this.down('p').remove());

???

Thanks in advance,

Walter

--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to