Empty check checkValidity null protection

Useful when used against contenteditable divs to avoid exceptions
This commit is contained in:
jplanells 2015-02-11 01:20:16 +01:00
parent 981ef3121b
commit 6e10090a86

View File

@ -111,7 +111,7 @@
}) })
.on("keyup change", ".form-control", function() { .on("keyup change", ".form-control", function() {
var $this = $(this); var $this = $(this);
if($this.val() === "" && $this[0].checkValidity()) { if ($this.val() === "" && (typeof $this[0].checkValidity != "undefined" && $this[0].checkValidity())) {
$this.addClass("empty"); $this.addClass("empty");
} else { } else {
$this.removeClass("empty"); $this.removeClass("empty");