Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
  <table>
  <tr class="tr_cond"> 
    <td>BLA</td>
    <td>BLA</td>
    <td>BLA</td>
    <td>BLA</td>
    <td><input type="button" name="add" value="+" class="tr_condition"></td>
</tr>
  </table>
  
  
</body>
</html>
 
$("table").on('click', '.tr_condition', CloneCondition);
var addIDs = ['tabl','col','oper','val'];
var cloneCount = 0;
function CloneCondition(){
  
    cloneCount++;
  
    $(this).closest('.tr_cond')
        .clone()
        .insertAfter(".tr_cond:last");
  
    // after clone is done let's go for the last (new) one
  $('.tr_cond:last td').not(':last').each(function(i){
       $(this).attr('id', addIDs[i] +'Cond'+ cloneCount);
    });
  
}   
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers