clear form with javascript code example Example: javascript reset form document.querySelector("form").reset();