1

Hi I looked around the internet and could not find on how to trigger an event when leaving a InputSurface in Famo.us.

I got it to work when clicking on the inputSurface.

usernameTextbox.on("click", function () {
        if (usernameTextbox.getValue() == "Username") {
            usernameTextbox.setValue("");
        }
    })

Thanks

Uriil
  • 11,948
  • 11
  • 47
  • 68

1 Answers1

3

You want to use the blur event. The blur event is the opposite to the focus event.

Here is a working example of InputSurface.on 'blur' .. Hope it helps!

var Engine          = require('famous/core/Engine');
var Modifier        = require('famous/core/Modifier');
var InputSurface    = require('famous/surfaces/InputSurface');

var context = Engine.createContext();

var inputSurface = new InputSurface({
    size:[200,40]
});

inputSurface.on('blur',function(){
    console.log("Hello Blur!");
});

context.add(new Modifier({ origin:[0.5,0.5] })).add(inputSurface);
johntraver
  • 3,612
  • 18
  • 17