<button type="button" onclick="ClearFields();">Clear</button> function ClearFields() { document.getElementById("textfield1").value = ""; document.getElementById("textfield2").value = ""; }