jQuery clone duplicate IDs

If you need a way to reference the list items after you’ve cloned them, you must use classes, not IDs. Change all id=”…” to class=”…”

If you are dealing with legacy code or something and can’t change the IDs to classes, you must remove the id attributes before appending.

$("#MainConfig").clone(false).find("*").removeAttr("id").appendTo($("#smallConfig"));

Just be aware that you don’t have a way to reference individual items anymore.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)