我有一类文本框并试图将 onChange 事件附加到该类。下面的代码有效,我从 calData 在 Firefox 中获得输出,但在 Chrome 上不起作用
enter code here
<ul id="week_list">
<li id="34">
Week 1 - <input class="test_class" type="number" id="week_34" name="week[]">
</li>
<li id="35">
Week 2 - <input class="test_class" type="number" id="week_35" name="week[]">
</li>
</ul>
//Javascript
var Test =
{
init: function(config) {
this.bindEvents();
},
bindEvents: function() {
this.config.clTest.on('change',this.calData);
},
calData: function(){
console.log("calculating");
},
};
Test.init({
clTest: $('.test_class'),
});