diff --git a/ignite-html-validate.js b/ignite-html-validate.js
index 4a4ad50..7d21ec5 100644
--- a/ignite-html-validate.js
+++ b/ignite-html-validate.js
@@ -162,6 +162,23 @@ IgniteTemplate.prototype.validate = function (callback) {
//Register a new validator
this._validators.push(() => {
+ //Get the elements current value
+ var type = this.element.hasAttribute("type") ? this.element.getAttribute("type").toLowerCase().trim() : null;
+
+ //Get the value from the element.
+ var value = null;
+ if (type == "checkbox") {
+ value = this.element.checked;
+ } else if (type == "radio") {
+ value = this.element.checked;
+ } else if (type == "number") {
+ value = Number(this.element.value);
+ } else if (this.element.hasAttribute("contenteditable") && this.element.getAttribute("contenteditable").toLowerCase().trim() == "true") {
+ value = this.element.textContent;
+ } else {
+ value = this.element.value;
+ }
+
//If the element already has a validation element remove it.
if (this.element._validation && this.element._validation.isConnected) {
this.element._validation.remove();
@@ -177,7 +194,7 @@ IgniteTemplate.prototype.validate = function (callback) {
//Run the target to see if we passed validation.
var error = false;
target(
- this._elementValue,
+ value,
(msg, duration = 4000) => { notify(this.element, "error", msg, duration); error = true; },
(msg, duration = 4000) => { notify(this.element, "warning", msg, duration); },
(msg, duration = 4000) => { notify(this.element, "success", msg, duration); },