From abc91f4147e0d2adc75e53c58e7aac1297698359 Mon Sep 17 00:00:00 2001 From: Julien Dutriaux Date: Fri, 14 Nov 2014 16:07:27 +0100 Subject: [PATCH] ixed onChange unexpectedly triggered Checking the value for a checkbox input is not wisely, prefer checking the "checked" attribute, we also need to verify if there is a value in the input because default value (for example a text input) is "" and $(this).attr("value") returns undefined. Rel #205 --- scripts/material.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/material.js b/scripts/material.js index de255727..30cabe1b 100644 --- a/scripts/material.js +++ b/scripts/material.js @@ -136,8 +136,8 @@ (function() { // This part of code will detect autofill when the page is loading (username and password inputs for example) var loading = setInterval(function() { - $("input").each(function() { - if ($(this).val() !== $(this).attr("value")) { + $("input[type!=checkbox]").each(function() { + if ($(this).val() && $(this).val() !== $(this).attr("value")) { $(this).trigger("change"); } });