Answer the question
In order to leave comments, you need to log in
How to hang a handler on a node in BEM?
Just starting to try BEM. I master the lesson Master class on BEM from Yandex
At about 1:45:00 we write a handler for the form. There we must indicate that the form is, as it were, ready to interact with js by specifying js()(true) in bemhtml . Next, we write form.js , where we initialize the form itself, and then a problem arose. In desktop.block I added a folder form , in it I created these files form.js and form.bemhtml.js ( form.bemhtml doesn't work either). The collector does not seem to see these files and does not react to them. Maybe I'm not doing the right thing at all. Tell. I am attaching the contents of the files:
modules.define('form', ['i-bem__dom'], function (provide, BEMDOM) {
provide(BEMDOM.decl(this.name, {
onSetMod : {
js: {
inited : function () {
this.bindTo('submit', this._onSubmit);
}
}
},
_onSubmit: function () {
this.emit('submit');
},
getVal: function () {
return this.domElem.serialize();
}
}));
});
block('form')(
tag()('form'),
js()(true)
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question