This is what I placed in the click event of the button: var cInput = xfa.host.response("Enter number of rows you want to add:", "Add rows", "1", false),n = parseInt(cInput, 10) > 0 ? parseInt(cInput, 10) : 1,i = 0;for (var i=Rows;i>=-1;i--){{Table1._Row1.removeInstance(i);}