If you replace an element, even if the replacement has the same ID as
the original, you will have toinitialize a new InPlaceEditor.  It
grabs a reference to the element instance, which is different for the
replacement than for the original.  It would be best to *also* remove
the InPlaceEditor for the previous version of the element, so as to
free up memory.

So, say you have this div:

    <div id='content'>
    <p id='editme'>Blah blah blah</p>

And you put an editor on the paragraph:

    new Ajax.InPlaceEditor('editme', url);

If you replace it:

    $('div').update('<p id="editme">new content</p>');

...then the previous paragraph element ceases to exist, and there's
nothing to indicate that the new element has an InPlaceEditor.

Instead, remember a reference to the editor when first setting it up:

    var editor;
    editor = new Ajax.InPlaceEditor('editme', url);

...and then destroy it and recreate it when updating:

    if (editor) {
        editor = undefined;
    $('div').update('<p id="editme">new content</p>');
    editor = new Ajax.InPlaceEditor('editme', url);

That's all inline code, you'll probably want to put some structure
around it, but you get the idea.

T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jul 26, 2:25 pm, Drum <csteph2...@gmail.com> wrote:
> I have a page which include a list of user entered keywords on which I
> want to be able to use Ajax.InPlaceEditor.
> It works fine when the initial page loads, The initial list is in the
> initial HTML and includes the calls to the editor.
> When, however, the div with the list and calls to the editor has been
> written using innerHTML = responseText, it does not work.
> I get no errors in Firebug, but the javascript is not running.
> Any help?
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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to