0

How to make a web app to receive key event?

Hi there,

I use mojito 0.7.1.

I'd like to detect pressed-key at every where in my web app.

I tried

----------------------- binder/index.js ----------------------- bind: function(node) { var me = this; this.node = node;

this.node.one("#keyReciever").on("keyup", function(evt) {
    alert("j");
});

}

----------------------- views/index.hb.html-----------------------

----------------------- assets/index.css-----------------------

keyReciever {

<position:fixed;> 
<left:0;>
<top:0;> 
<width:100%;> 
<height:100%;>
z-<index:1000;> 
<opacity:0.1;>
background-color:#FFFFFF;

}

But no alert window show out after I press keys.

What is the problem happened?

by
3 Replies
  • Sorry, I have no idea what's going on about my codes.

    Here is my codes:

    ----------------------- binder/index.js -----------------------

    bind: function(node) {
    var me = this;
    this.node = node;
    this.node.one("#keyReciever").on("keyup", function(evt) {
    alert("j");
    });
    }

    ----------------------- views/index.hb.html-----------------------

    < div id="{{mojit_view_id}}">
    < div id="keyReciever"></ div>
    </ div>
    0
  • Does your web app respect the requirements for binders ? 1) Use a HTMLFrameMojit (or other Frame mojit) ? 2) Deploy the code to the client ? 3) Mojit container has id ( {{mojit_view_ide}}) <-- OK See -binders-app-reqs

    0
  • I failed to put correct link.

    See this developer.yahoo.com/cocktails/mojito/docs/intro/mojito_binders.html#mojito-binders-app-reqs

    0

Recent Posts

in Yahoo! Mojito