I haven't test this but its modified from another set of code i have that is working to do this
var idNumber = 1; function addElement(id){ if($('#span1').html()){ $('#span1').append($('#' + id + idNumber).clone()); $('#span1 #' + id + idNumber).attr('id', '#' + id + (idNumber + 1)); idNumber++; } } Here is my original code ... // form effects function addRequest(){ $('#genList').append($('#genItem.template').clone()); genNumber++; $('#genList #genItem.template').removeClass('template').attr('id', 'genItem_' + genNumber).fadeIn('slow').find('input,select').each (function(){ $(this).attr('name', $(this).attr('name') + '[' + genNumber + ']'); }); } Chris On Sep 25, 6:31 pm, jan1979 <jan.zitn...@gmail.com> wrote: > Hello. > > I have following code: > > function addElement(id) { > $(document).ready(function(){ > if ( $("#span1") ) { > $(id).clone().prependTo("#span1"); > } > }); > > } > > How can I rename cloned element? Should be fine to increase its name by one, > e.g.: original id1 into cloned id2 and so on. > -- > View this message in > context:http://www.nabble.com/How-to-rename-cloned-element-id-%28increase-by-... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.