Not entirely clear what is required to be cloned - the code you have shouldn't really be cloned 'as is' because it has ids in it, which would require a fair amount of manipulation to make it valid. If you simply want to format it into a more readable/maintainable form then, as an example...
var code = [ '<div id="block">' , '<h1>BITE ME! </h1>' , '<div class="eplist">' , '<table>' , '<th>' // should this be a <tr>? , '<td>Title</td>' , '<td>Episodenumber</td>' // ... etc, etc ... , '<h2>Remove ep from list</h2>' , '</a>' , '</div>' ].join(''); But, yes you can clone just one instance of a class, eg ... $('.class:first').clone() On May 27, 10:06 pm, tripdragon <[EMAIL PROTECTED]> wrote: > have this code that works! But looks like butt. As well as that this > is a recipe for hell every-time I need to update it. > I had clone working on the generated html code from the Rails server > code. But in my simple tests the clone was cloning the class or id and > it then more just make clones of the clones. Woot. So it became a > power of 2 which as you know. ... > > From my short reading I cannot find any tools to fix jquery to paste > code cleaner due to javascript restriction spacing.. > > <script type="text/javascript"> > $(document).ready(function(){ > > $('#addmore').click(function() { > $('#block').append('<div id="block"><h1>BITE ME! </h1> <div > class="eplist"><table> <th> <td>Title</td> <td>Episodenumber</td> > <td>Status</td> <td>Watched</td> <td>Have</td> <td>Next</td> > <td>Published</td> </th><tr> <td> <input > id="episode_episode_attributes__title" > name="episode[episode_attributes][][title]" size="30" type="text" /> </ > td> <td> <input id="episode_episode_attributes__episodenumber" > name="episode[episode_attributes][][episodenumber]" size="30" > type="text" /> </td> <td> <select > id="episode_episode_attributes__status" > name="episode[episode_attributes][][status]"><option > value="1">Watching it</option> <option value="2">Saw it</option></ > select> </td> <td> <input id="episode_episode_attributes__watched" > name="episode[episode_attributes][][watched]" type="checkbox" > value="1" /><input name="episode[episode_attributes][][watched]" > type="hidden" value="0" /> </td> <td> <input > id="episode_episode_attributes__have" name="episode[episode_attributes] > [][have]" type="checkbox" value="1" /><input > name="episode[episode_attributes][][have]" type="hidden" value="0" /> > </td> <td> <input id="episode_episode_attributes__next" > name="episode[episode_attributes][][next]" type="checkbox" value="1" /><input > name="episode[episode_attributes][][next]" type="hidden" > > value="0" /> </td> <td> <input > id="episode_episode_attributes__published" > name="episode[episode_attributes][][published]" type="checkbox" > value="1" /><input name="episode[episode_attributes][][published]" > type="hidden" value="0" /> </td></tr></table> <h2>Notes</h2> <p> > <textarea cols="100" id="episode_episode_attributes__notes" > name="episode[episode_attributes][][notes]" rows="2"></textarea> </ > p><a href="#" class="puk"><h2>Remove ep from list</h2></a></div>'); > }); > > $('.puk h2') > .livequery('click', function(event) { > $(this).parents('.eplist').remove(); > return false; > }); > > }); > > </script>