Skip to content

Instantly share code, notes, and snippets.

@alexbaumgertner
Created July 18, 2013 15:29
Show Gist options
  • Save alexbaumgertner/6030277 to your computer and use it in GitHub Desktop.
Save alexbaumgertner/6030277 to your computer and use it in GitHub Desktop.
вопрос по i-bem
/** @requires BEM */
/** @requires BEM.DOM */
(function(undefined) {
BEM.DOM.decl({ block: 'authorization', modName: 'state', modVal: 'recovery'}, {
onSetMod : {
'js' : function() {
var _this = this;
this.recoveryInput = this.findBlockInside('authorization-info').findBlockInside('input');
this.submitButton = this.findBlockInside({ block: 'button', modName: 'type', modVal: 'submit' });
this.setSubmitButtonState(this.recoveryInput.domElem.val());
this.recoveryInput.domElem.on('keyup change input', function () {
_this.setSubmitButtonState($(this).val())
});
}
},
setSubmitButtonState: function (email) {
var simpleEmailRE = /^\S+@\S+$/;
if (simpleEmailRE.test(email)) {
this.submitButton.setMod('state', 'enabled');
} else {
this.submitButton.setMod('state', 'disabled');
}
}
}, {
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment