From ba193d3cde5df0e4efd2ff6a999bc2a71fa4e068 Mon Sep 17 00:00:00 2001 From: Skriptkid9 Date: Thu, 24 Jul 2014 02:08:12 +0530 Subject: [PATCH] Form.Element.clear() works on checkbox Form.Element.clear() un-checks checkboxes. --- src/prototype/dom/form.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/prototype/dom/form.js b/src/prototype/dom/form.js index da3f2f25d..4a430bac8 100644 --- a/src/prototype/dom/form.js +++ b/src/prototype/dom/form.js @@ -603,7 +603,13 @@ Form.Element.Methods = { * } **/ clear: function(element) { - $(element).value = ''; + var elementType = $(element).type; + + if(elementType === "checkbox" || elementType === "radio") + element.checked = false; + else + $(element).value = ''; + return element; },