Hi,

Element#insert returns a reference to the same element you called it
on, not the new content. Just change your first line to

    var div1 = new Element('div', { 'class': 'new-section' });
    div.insert(div1);

...and the rest should work.

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On Feb 20, 6:24 pm, kstubs <[email protected]> wrote:
> What is wrong with the following, the bad result is the new input
> elements are not contained by the new div element:
>
> Javascript:
> var div1 = div.insert(new Element('div', { 'class': 'new-section' }));
> div1.insert(new Element('input', { 'name': 'newsection-name-' + count,
> 'class': 'newsection-name item-' + count }));
> div1.insert(new Element('input', { 'name': 'newsection-val-' +
> count }));
>
> Output - FF:
> <div class="new-section"></div><input name="newsection-name-0"
> class="newsection-name item-0"><input name="newsection-val-0">

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to