Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Dynamic Clone Fields

Hi there, hope for some help, i have a form the gets data from a database, im using Ajax to get it, and in this form i can duplicate the fields (Select list), but the problem is when i duplicate or add a clone fields, if i chave one of them, all of them changes, how can i prevent from this happening?

I leave here the code:

$(document).ready(function() { $(".grupomuscular").change(function() { var id=$(this).val(); var dataString = 'id='+ id;

    $.ajax
    ({
    type: "POST",
    url: "exercicios-ajax.php",
    data: dataString,
    cache: false,
    success: function(html)
    {
    $(".exercicio").html(html);
    } 
    });

    });

    });