title: Assign a argument value for onclick on dynamic creation of input element
body: <p>I have a JSON object and I create a table with those values and also add a remove button as below</p>
  
  <pre><code>for (var keyValue in thisAdminResult) {
      if (thisAdminResult.hasOwnProperty(keyValue)) {
  
          var row = document.createElement('tr');
          var firstColumn = document.createElement('td');
          var secondColumn = document.createElement('td');
          var thirdColumn = document.createElement('td');
          var fourthColumn = document.createElement('td');
  
          var password = document.createElement('input');
          password.type = "password";
  
          var removeButton = document.createElement('input');
          removeButton.type = "button";
  
          var updateButton = document.createElement('input');
          updateButton.type = "button";
  
          firstColumn.appendChild(document.createTextNode(keyValue));
  
          password.value = thisAdminResult[keyValue];
  
          secondColumn.appendChild(password);
          removeButton.value = 'remove';
  
          removeButton.onclick = function () {
              remove(keyValue);
          }
  
          thirdColumn.appendChild(removeButton);
  
          updateButton.value = 'update'
          updateButton.onclick = function () {
              //update(keyValue);
          }
  
          fourthColumn.appendChild(updateButton);
  
          row.appendChild(firstColumn);
          row.appendChild(secondColumn);
          row.appendChild(thirdColumn);
          row.appendChild(fourthColumn);
  
          table.appendChild(row);
      }
  }
  </code></pre>
  
  <p>what I need to get done is to call remove function with particular value of 'keyValue' variable, when each remove button is pressed.</p>
  
  <p>But with above code</p>
  
  <p>when I click any of remove button, it calls remove function with same argument value(last value of 'keyValue').</p>
  
  <p>Can someone tell me what I have to do this get corrected.</p>