Page 1 of 1

keydown event

Posted: Wed Oct 03, 2012 5:42 am
by Bob Fludder

I am trying to find if the enter key has been pressed. I can see the various key... events but how then do i get the keyCode ?


keydown event

Posted: Wed Oct 03, 2012 7:56 am
by Maryna Brodina

Hello! I'm not sure I understand your question. Could you clarify please?


keydown event

Posted: Wed Oct 03, 2012 11:39 am
by Bob Fludder

Did you get my email ? Anyway what I'm trying to achieve is to see if someone has pressed the enter key and if so then run the same procedure as if they had clicked on a button


keydown event

Posted: Wed Oct 03, 2012 12:08 pm
by Maryna Brodina

You can use event.which that includes code of pressed button.
enter key keycode is equal to 13


keydown event

Posted: Wed Oct 03, 2012 12:20 pm
by Bob Fludder

I tried event.which and firebug says event is not defined. You have to forgive me I can barely spell javascript..


keydown event

Posted: Wed Oct 03, 2012 12:34 pm
by Maryna Brodina

Such events probably only available when running in desktop browser. I don't think they are available in a mobile browser (as there is no keyboard).


keydown event

Posted: Wed Oct 03, 2012 12:43 pm
by Bob Fludder

Hi. Just finished testing a solution (for me at least). I ended up defining a new event on page load and linked it to the component. Seems to work fine so far.
This is my code (for now at least):

Tiggzi("password").keydown(function(event){
alert("Key: " + event.which);
};


keydown event

Posted: Wed Oct 03, 2012 12:48 pm
by Bob Fludder

oops. Minor mistake - missing a ).

Tiggzi("password").keydown(function(event){
alert("Key: " + event.which);
});


keydown event

Posted: Sat Jun 22, 2013 4:47 pm
by Shahrukh Badar5891231

your function helps me alot.
thanks


keydown event

Posted: Sun Jun 23, 2013 1:37 pm
by Emmz

True Marina. There are no keycodes on Android and the like