复制器ajax和表格重置器

Hello all i am having a site where users can add experience and while adding experience they can add and remove more number of fields but in the added/appended data there is a input type date which sends the same date all time like

my code is

<div class="full_exp_9092k" id='duplicater'>
    <div class="full_one_row_009so">
        <div class="obe_left_dibbhsy78">
            <div class="header_009sos00dd_d">
                Company Name <span>*</span>
            </div>
            <div class="maind_TAxefst67s77s">
                <input type="text" name="comp[]" required placeholder="company Name" class='cname_990s_EXp'/>
            </div>
        </div>
        <div class="obe_left_dibbhsy78">
            <div class="header_009sos00dd_d">
                Department Name <span>*</span>
            </div>
            <div class="maind_TAxefst67s77s">
                <input type="text" name="dept[]" required placeholder="Department Name" class='cname_990s_EXp'/>
            </div>
        </div>
    </div>

    <div class="full_one_row_009so">
        <div class="obe_left_dibbhsy78">
            <div class="header_009sos00dd_d">
                From Date <span>*</span>
            </div>
            <div class="maind_TAxefst67s77s">
                <input type="date" class='TEx_About_allihh' name="exsdate[]"/>
            </div>
        </div>
        <div class="obe_left_dibbhsy78">
            <div class="header_009sos00dd_d">
                To Date <span>*</span>
            </div>
            <div class="maind_TAxefst67s77s">
                <span id='some_end_dateid'><input type="date" class='TEx_About_allihh' name="exedate[]"/></span>
            </div>
        </div>
    </div>

    <div class="full_one_row_009so">
        <div class="obe_left_dibbhsy78">
            <div class="header_009sos00dd_d"></div>
            <input type="button" name="addmore" value="Add More" class='button small white' onclick='duplicate();'/>
        </div>
        <div class="small_cane_font_col">Currently working <input type="radio" name="workingnow[]" value="1" id="click_working_now"/></div>
    </div>
</div>

JS

<script>
    $(function() {
        $("input[type='date']").cdp({
            addNullOption : true,
            nullOptionText: "Select"
        });
    });

    var i = 0;
    var original = document.getElementById('duplicater');

    function duplicate(){
        $('#some_end_dateid').show();
        var clone = original.cloneNode(true); // "deep" clone
        i = ++i;
        clone.id = "duplicetor"+ i; // there can only be one element with  an ID
        original.parentNode.appendChild(clone);
        addButton(clone.id,i);
        clearCloneForm(clone.id);
    }

    function clearCloneForm(id){ 
        var divId = '#'+id;
        $(divId).find(".cname_990s_EXp").each(function() {
            $(this).val('');
        });
    }

    function addButton(id,ii){ 
        var divId = '#'+id;
        $(divId).append('<input type="button" value="Remove" class="button small red" style="margin-left:5px;" id="'+ii+'" onclick="rBlock('+ii+')" />');
    }
</script>

THE PROBLEM

when i submit the date and print

PHP

     $comps=$_POST['comp'];
     $exedate=$_POST['exedate'];
     $exsdate=$_POST['exsdate'];
     $dept=$_POST['dept'];
     @$workingnow=$_POST['workingnow'];

      print_r($exedate);

i get the same date in all array which is the date in the first row.

I cannot duplicate the problem - all dates are different ( if entered manually each time ) when posted. However, if I enter a from and to date and then clone them the values are also cloned so then, when the form is posted the values would be the same. The cuplrit I think is the way in which you attempt to clear the values from the cloned nodes, it misses the date fields. Change the function to:

function clearCloneForm(id){ 
    var divId = '#'+id;
    $(divId).find(".cname_990s_EXp,.TEx_About_allihh").each(function() {
        $(this).val('');
    });
}