Avrei una domanda!
Ho la necessità di duplicare un div tramite jquery e fin qui tutto bene.....
Il problema sorge quando ho bisogno di manipolare il clone creato.
In pratica dovrei creare delle istanze del div iniziale e dovrei poter agire su questi div clonati.
Avete qualche soluzione?
Codice PHP:
<script language="javascript">
// set_add_del makes sure that we dont show a [-] button
// if there is only 1 element
// and that we only show a [+] button on the last element
function set_add_del(){
$('.remove_cat').show();
$('.add_cat').hide();
$('.add_cat:last').show();
$(".remove_cat:last").show();
}
function selrem(clickety){
$(clickety).parent().remove();
set_add_del();
return false;
}
function seladd(clickety){
$('.category_block:last').after(
$('.category_block:last').clone());
set_add_del();
return false;
}
/* $(document).ready(function(){set_add_del();}); */
</script>
Codice PHP:
<DIV id=editor>
<DIV class="block snap-to-grid" title="Boum boum" style=" left:10; WIDTH: 800px; TOP: 10px; HEIGHT: 400px;
background-color:#0099CC;">
<div class="category_block" style="z-index:101;">
<DIV class="block" style=" left:810px; WIDTH: 100px; HEIGHT: 10px; background-color:#00CC66;">
<DIV class=handle></DIV>
<DIV class=resize></DIV>
[url="#"]RIMUOVI[/url]
[url="#"]AGGIUNGI[/url]
</DIV>
</DIV>
</div>
</div>
Come faccio ad assegnare ad ogni clone un colore diverso ad esempio o un nome diverso?
Grazie anticipatamente.