Hi, Michael...

I was having a similar problem cloning image inputs
and found this solution for that problem, which might
also be modified to solve your li cloning problem.

In the notes, it basically says that not all modern
browsers (IE, I think is the problem here) updates
the values of cloned elements.  So this fellow, Ben Nadel,
developed a word-around:

Here's the link...

http://www.bennadel.com/blog/1375-Ask-Ben-Dynamically-Adding-File-Upload-Fields-To-A-Form-Using-jQue
ry.htm

Rick



> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Michael Price
> Sent: Wednesday, January 28, 2009 7:10 AM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Cloning list items in OL screws up numbering in IE
> 
> 
> Hi all,
> I've got an ordered list <OL> with 5 list items. Each list item contains
> an input and the list is, as you would expect, numbered from 1 to 5.
> There is a link to add another item to this list which I have bound the
> following function to:
> 
> $("#materialadd").click(function() {
>       $("#materialol li:last").clone().appendTo("#materialol");
>       $("#materialol li:last").hide().fadeIn("fast");
> 
>       return false;
> });
> 
> #materialol is the list - the last item is cloned and appended to the
> end of the list, then hidden and faded in so the user can spot the change.
> 
> In Firefox, this works perfectly, and the list numbering is continued.
> Click it once, and the next item is 6, then 7, then 8.......
> 
> In IE...... not so much. IE 6 and 7 both execute the cloning and
> addition process but the list items numbers of the cloned + added items
> are 1. So you end up with a list numbered 1, 2, 3, 4, 5, 1, 1, 1, 1, 1.....
> 
> Is there another way for me to do what I'm doing that will work properly
> in IE as well as FF?
> 
> I'm using jQ 1.2.6 by the way.
> 
> Regards,
> Michael Price


Reply via email to