diff --git a/lib/main.js b/lib/main.js index b9c8a9b..68747d8 100644 --- a/lib/main.js +++ b/lib/main.js @@ -243,6 +243,11 @@ if (elem.form) { form = elem.form; + // If the type of the property is a string then we have a "form" attribute and need to get the real form + if (typeof form === "string") { + form = document.getElementById(form); + } + // Set a flag on the form so we know it's been handled (forms can contain multiple inputs) if (!form.getAttribute(ATTR_FORM_HANDLED)) { Utils.addEventListener(form, "submit", makeSubmitHandler(form)); diff --git a/test/default/tests.html b/test/default/tests.html index 81de179..4387b97 100644 --- a/test/default/tests.html +++ b/test/default/tests.html @@ -53,7 +53,12 @@ + +
+ +
+ - \ No newline at end of file +