Last active
December 19, 2015 00:19
-
-
Save tiagobbraga/5867438 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resetForm = (form) -> | |
frm_elements = form.elements | |
for element in frm_elements | |
field_type = element.type.toLowerCase(); | |
switch field_type | |
when "text", "textarea", "hidden" then element.value = "" | |
when "radio", "checkbox" then element.checked = false | |
when "select-one", "select-multi" then element.selectedIndex = -1 | |
else element.innerHTML = ""; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment