geokeyboard.js

JavaScript library for using Georgian keyboard layout in HTML elements.

View the Project on GitHub

Change callbacks

Sometimes you’ll need to perform specific actions when an element becomes active/inactive with Geokeyboard.

When specific selector(s) get changed

In this case you need to provide change option (a function that receives current state as its first argument) to selector configuration. This is a third parameter of constructor and second for listen method.

var geokb = new Geokeyboard;
geokb.listen('#input1', {
    change: function(active) {
        if (active) {
            // ...
        } else {
            // ...
        }
    }
})

or

new Geokeyboard('#input1', {}, {
   change: function(active) {
       if (active) {
           // ...
       } else {
           // ...
       }
   } 
});

JSFiddle example

When any of selectors within an instance change

In this situation you’re using the same function in constructor parameters, not selector options:

new Geokeyboard('#input1', {
    change: function(active) {
       if (active) {
           // ...
       } else {
           // ...
       }
    }
}, {});

See an example

When you type in any of provided elements

new Geokeyboard('#input1, #input2', {}, {
    type: function(selector, fullText) {
        // ...
    }
})

See an example

Finally, you can read about How to extend geokeyboard.js