Pressing 'return' to activate button

Nate Maingard shared this question 5 years ago
Answered

If I'm in a text field and want to 'press' a particular button by pressing return (enter) on my keyboard, how would I do that?


Thanks


nate

Comments (5)

photo
1

by press I meant activate

photo
1

Take a look to this tutorial.


http://www.justinmind.com/prototyper/...

photo
1

Ok, but that doesn't actually activate anything, it just jumps from text box to text box.

photo
1

Say, you have a button and when you click it, a box (hidden when the page loads) shows up.


And you want to replicate that action but instead of clicking that button, you have to be in the text field and press enter.


Here's the scenario, you have a text field, a box, and a button. Take a look at the screen shot.


0807bc29ccfc597364e394aebca3eb81


Now, to set the text field to do the same action like the button does when you click enter, select the text field -> click Add event -> select the on Click event option and choose Keyboard -> on Key Down -> click the pencil icon -> press enter from your keyboard -> select Show/Hide -> select the box -> press OK


I hope this helps!

photo
1

Perfect, I understand completely, thank you. I actually just copied the whole 'on mouse click' event from the 'sign in' button I had, to the text field, then changed it from 'on mouse click' to 'on key up' with 'return' as the key! Works perfectly, thanks again!