Please try that:
<script>
$(document).ready(function(){
var add = '<tr valign="top"><th scope="row"><label for="customFieldName">Custom Field</label></th><td>';
add+= '<input type="text" class="code" id="customFieldName" name="customFieldName[]" value="" placeholder="Input Name" /> ';
add+= '<input type="text" class="code" id="customFieldValue" name="customFieldValue[]" value="" placeholder="Input Value" /> ';
add+= '<a href="javascript:void(0);" class="remCF">Remove</a></td></tr>';
$(".addCF").click(function(){ $("#customFields").append(add); });
$("#customFields").on('click','.remCF',function(){
var inx = $('.remCF').index(this);
$('tr').eq(inx+1).remove();
});
});
</script>