owl
owl

Reputation: 4461

Oninput event in ace.js

I have a few editors on one page. They are stored in an array.

How to determine the editor where I enter text?

    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
        });
    }   

Thanks in advance.

Upvotes: 0

Views: 285

Answers (1)

Banana
Banana

Reputation: 7463

according to the examples Here, you can see that ace's on functions have a this variable that references the caller

for(var i = 0; i < types.length; i++) {
    editors[types[i]].on('input', function() {
        // EG:
        console.log(this);
    });
}   

Upvotes: 1

Related Questions