JSFiddle - React, Tailwind, and code Playground
HTML
<table width="100%" cellspacing="4" cellpadding="5" border="0">
<tbody><tr id="logical1" class="clonedInput1">
<td class="first-column"> </td>
<td><input type="radio" name="logicalOperator" default>
AND
<input type="radio" name="logicalOperator" >
OR
<input type="radio" name="logicalOperator" >
NOT
</td>
</tr>
<tr id="condition1" class="clonedInput">
<td class="first-column">Condition #2</td>
<td><span style="float:left; padding-right: 10px;">
<select id="firstname" name="firstname" class="standard_select" style="width:147px; background:#fff;">
<option>Agent Name</option>
<option>Call list</option>
<option>Call Type</option>
<option>Caller Id</option>
<option>Campaign Name</option>
<option>Channel Name</option>
<option>Connect Time</option>
<option>Customer Name</option>
<option>Duration</option>
<option>End Time</option>
<option>Phone Number</option>
<option>Start Time</option>
</select> <select id="firstname" name="firstname" class="standard_select" style="width:147px;">
<option>Equals =</option>
<option>Not Equal <></option>
<option>Greater ></option>
<option>Less <</option>
<option>Contains</option>
<option>In</option>
<option>Not In</option>
</select> <input type="text" id="conValue" name="conValue" class="short_input" value="" style="width:147px;">
</span>
</td>
</tr>
<tr>
...
JavaScript
$('#btnAdd').click(function() {
var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have
var num1 = $('.clonedInput1').length; // how many "duplicatable" input fields we currently have
var newNum = new Number(num + 1); // the numeric ID of the new input field being added
var newNum1 = new Number(num1 + 1); // the numeric ID of the new input field being added
// create the new element via clone(), and manipulate it's ID using newNum value
var newElem = $('#condition' + num).clone().attr('id', 'condition' + newNum);
// create the new element via clone(), and manipulate it's ID using newNum value
var newElem1 = $('#logical' + num1).clone().attr('id', 'logical' + newNum1);
// manipulate the name/id values of the input inside the new element
newElem.children(':first').attr('id', 'name' + newNum).attr('name', 'name' + newNum);
// manipulate the name/id values of the input inside the new element
newElem.children(':first').attr('id', 'name' + newNum1).attr('name', 'name' + newNum1);
// insert the new element after the last "duplicatable" input field
$('#condition' + num).after(newElem).after(newElem1);
// insert the new element after the last "duplicatable" input field
//$('#logical' + num1).after(newElem1);
// enable the "remove" button
$('#btnDele').attr('disabled','');
// business rule: you can only add 5 names
if (newNum == 5)
$('#btnAdd').attr('disabled','disabled');
// business rule: you can only add 5 names
if (newNum1 == 5)
$('#btnAdd').attr('disabled','disabled');
});
...