Actually, I see there are two other prototype calls:
Element.remove(''foo'');
Which does a parentNode.removeChild(), and
Element.update(''foo'', ''some html'');
Which does element.innerHTML = ''some html'', and executes any
script that
is in the string you pass in.
-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
On Behalf Of Tom
Fakes
Sent: Saturday, January 07, 2006 4:48 PM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: RE: [Rails-spinoffs] Replacing an html chunk with a different
htmlchunk
I have some code replaces an existing HTML element with new HTML. It
can be
found here:
http://blog.craz8.com/articles/2005/12/15/rails-rjs-templates-need-bette
r-re
place-semantics
The last chunk of code in that entry is an extension to the Element
class
that allows you to say:
Element.replace(''foo'', ''<div
id="foo">...</div>'');
Just add this to somewhere in your own JS code to use it.
You can also use this code to remove an element, but there may be a
better
way to do this:
Element.replace(''foo'', '''');
I''ve submitted this to Sam as a Prototype update.
-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
On Behalf Of
Jonathan
Boutelle
Sent: Saturday, January 07, 2006 4:38 PM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: [Rails-spinoffs] Replacing an html chunk with a different html
chunk
All,
I''m a big fan of the Insertion.* classes in prototype
(Insertion.Before, Insertion.After, Insertion.Top, Insertion.Bottom).
These classes solve the problem of adding new html to existing html
in the desired place. Very useful.
But what about replacing one chunk of HTML with another? Or removing
a specific chunk of HTML? These tasks come up just as often.
1)Am I correct that Prototype doesn''t solve this problem?
2)If so, what''s the best way to do this?
Regards,
----^-------^------^--------^-------^
Jon Boutelle
Principal, Uzanto Consulting
Mountain View, CA
Office Phone:650-564-0000
skype id: jboutelle
www.uzanto.com
www.jonathanboutelle.com
www.themindcanvas.com
----^-------^------^--------^-------^
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs