Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<button id="addRow">Add Row</button>
  <div id="sheet">
        
    </div>
</body>
</html>
 
var addRow = document.getElementById('addRow');
(function(){
 
  var text = '';
for(var i = 1; i<= 2; i++) {
    text += "<div class='row'>";
    for(var j = 1; j<= 3; j++) {
        //createNode();
        text += "<input type='text' readOnly/>";
    }
    
    text += "<br>";
    text += "</div>";
}  
  sheet.innerHTML = text;
})();
addRow.addEventListener('click', function(){
    var rows = document.querySelectorAll('.row');
    var dupNode = rows[0].cloneNode(true);
    sheet.appendChild(dupNode);
}, false);
var inputs = document.getElementsByTagName('input');
for(var i = 0; i <= inputs.length - 1; i++) {
    inputs[i].addEventListener('click', function(){
      alert("clicked");
    }, false);
}
Output 300px

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

Dismiss x
public
Bin info
Ajeeypro
0viewers