![](/img/trans.png)
[英]How to ignore setValue in the .on('input') event (ace.js)
[英]Oninput event in ace.js
我在一页上有几个编辑器。 它们存储在数组中。
如何确定编辑器我在哪里输入文本?
for(var i = 0; i < types.length; i++) {
editors[types[i]].on('input', function() {
console.log( ? ); // How to get a current editor?
//console.log(editors[types[i]]); // Doesn't work
});
}
提前致谢。
根据此处的示例,您可以看到ace的on
函数具有一个this
变量, this
变量引用调用方
for(var i = 0; i < types.length; i++) {
editors[types[i]].on('input', function() {
// EG:
console.log(this);
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.