In this situation, you can use jquery . one () .
Attach a handler to the event for elements. A handler is executed no more than once for each type of event.
You will also need to change the add logic to add input and select inside the div with the id container in the .append_childdiv. soemthing like this:
$('.add_child').one('click',function() {
$div_open = $('<div id="container"></div>');
$input1 = $('<input type="text" placeholder="Child Name" />');
$input2 = $('<select name="gender"><option value="0">Male</option><option value="1">Female</option></select>');
$('.append_child').append($div_open);
$('.append_child #container').append($input1);
$('.append_child #container').append($input2);
});
Working demo
source
share