js method that clears text code example Example: clear textbox js function name() { document.getElementById('elementid').value = ""; }