diff --git a/src/spine.databind.coffee b/src/spine.databind.coffee index e544dde..1f7390c 100644 --- a/src/spine.databind.coffee +++ b/src/spine.databind.coffee @@ -249,14 +249,22 @@ class Checked extends Template if el.attr("type") is "radio" if result is value - el.attr("checked", "checked") - else - el.removeAttr("checked") + if not el.is(":checked") + el.attr("checked", "checked") + el.trigger("change") + else + if not el.is(":checked") + el.removeAttr("checked") + el.trigger("change") else - if not result - el.removeAttr("checked") + if result + if not el.is(":checked") + el.attr("checked", "checked") + el.trigger("change") else - el.attr("checked", "checked") + if el.is(":checked") + el.removeAttr("checked") + el.trigger("change") DataBind = binders: [ diff --git a/src/spine.databind.js b/src/spine.databind.js index 0f76595..6d5ccd6 100644 --- a/src/spine.databind.js +++ b/src/spine.databind.js @@ -470,15 +470,27 @@ value = el.val(); if (el.attr("type") === "radio") { if (result === value) { - return el.attr("checked", "checked"); + if (!el.is(":checked")) { + el.attr("checked", "checked"); + return el.trigger("change"); + } } else { - return el.removeAttr("checked"); + if (!el.is(":checked")) { + el.removeAttr("checked"); + return el.trigger("change"); + } } } else { - if (!result) { - return el.removeAttr("checked"); + if (result) { + if (!el.is(":checked")) { + el.attr("checked", "checked"); + return el.trigger("change"); + } } else { - return el.attr("checked", "checked"); + if (el.is(":checked")) { + el.removeAttr("checked"); + return el.trigger("change"); + } } } };