Button click function not working for more then one time

Button click function not working for more then one time

Dear All,

I had written the below code to create the element and append to html table ,And it's working for fine for only one time.

Can any one please help me for what reason it's working only for 1 time 

  1. <button onclick="myFunction()">Try it</button>
  2.  <table id="tblCustomListData" border="1" width="100%" style="overflow-x:auto;">
  3.               <thead>
  4.                      <tr class="bgcolorgray">
  5.                         <th>Sno</th>
  6.                         <th >Current DR</th>
  7.                      </tr>
  8.               </thead>
  9.             </table>
  10. </div >
  11. <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.2.js"></script>
  12. <script type="text/javascript">

  13. function myFunction() {

  14. var txtHTML = "";
  15. $('#tblCustomListData tbody').html('');

  16.      var i="10";

  17.         var button = document.createElement('input');
  18.         button.setAttribute('type', 'text');
  19.         button.setAttribute('value', i);

  20.       var tr = $('<tr>');

  21.           var td = $('<td>');
  22.           td.append(button);
  23.           tr.append(td);

  24.           var td = $('<td>');
  25.           td.append(i);
  26.           tr.append(td);
  27.           $('</tr>');

  28.      $("#tblCustomListData").append(tr);

  29. }

  30. </script>


  31. </body>
  32. </html>


Thanks
Learner.