Jquery CLONE table row issues
<p>I've a couple of small queries with some script I've used in the past.</p>

<p>Previously it worked well to clone a table row and delete a selected row.</p>

<p>But since upgrading to Jquery 3.1.0 it has stopped working.</p>

<pre><code>$(function() {
    $('#submitBtm').click(function() {
        var $newRow = $('#TemplateRow').clone(true).removeAttr('id');
        $newRow.find('#Site').val(''); $newRow.find('#Location').val('');
        $newRow.find('*').andSelf().removeAttr('id').removeAttr('disabled');

        $('#cloneTable tr:last').before($newRow);
        return false;
    });

    $('#cloneTable').delegate('.deleteRow:not(#TemplateRow .deleteRow)', 'click', function() {
            $(this).closest('tr').remove();
    });
});
</code></pre>

<p>I've googled and found the issue is due to <code>andSelf()</code>  If I remove the line with that in then the script works.  </p>

<p>Can anyone advise what that line does ?</p>

<p>Also each TR has a unique <code>data-val</code> eg:</p>

<pre><code>        &lt;tr id="TemplateRow" data-val='123456'&gt;
</code></pre>

<p>When I Add (clone) a new row I'd like to give it a unique data-val. At this point what it is doesn't matter as long as it's unique.</p>

<p>I thought I'd use the epoch time stamp so tried the following to set the data-val:</p>

<pre><code>var milliseconds = (new Date).getTime();
$newRow.find('[data-val]').val(milliseconds);
</code></pre>

<p>But the cloned row still has 123456, can any one help with that?</p>