From dc9a327a3ac77942274fab848a06b5c3309b5663 Mon Sep 17 00:00:00 2001 From: jplanells Date: Wed, 11 Feb 2015 01:20:16 +0100 Subject: [PATCH] Empty check checkValidity null protection Useful when used against contenteditable divs to avoid exceptions --- scripts/material.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/material.js b/scripts/material.js index 93123768..615c365d 100644 --- a/scripts/material.js +++ b/scripts/material.js @@ -111,7 +111,7 @@ }) .on("keyup change", ".form-control", function() { var $this = $(this); - if($this.val() === "" && $this[0].checkValidity()) { + if ($this.val() === "" && (typeof $this[0].checkValidity != "undefined" && $this[0].checkValidity())) { $this.addClass("empty"); } else { $this.removeClass("empty");