Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Pressing F2 key (Shift + Tab function) should go to PREVIOUS Field on the form - JavaScript

Posted on 2010-08-19
Medium Priority
Last Modified: 2012-05-10

I have a form with some textboxes. I need to have a Javascript function that will do the following:

On pressing F2 function key should go to PREVIOUS textbox field (Shift + Tab function)  on the form.

Can you please provide me the Javascript code ?

Question by:milani_lucie
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 40

Accepted Solution

Gurvinder Pal Singh earned 2000 total points
ID: 33475091
this link will help you in detecting the f2 keypress

check this to see how to trigger a default event for a key programmatically

Author Comment

ID: 33517723
I did something like this. But does not solve my issue. Gives "JavaScript" error:
<script language="javascript">
function func(e)
var unicode = e.keyCode ? e.keyCode : e.charCode;
var evtobj=window.event ? event : e;
if (evtobj.shiftKey && unicode == 9)
<form name="form1">
<input type="text" name="text1" onkeyup="func(event);" />
<input type="text" name="text2" onkeyup="func(event);" />
<input type="text" name="text3" onkeyup="func(event);" />

Author Comment

ID: 33765922
Can you please provide sample code ?

Author Comment

ID: 33995979
Any comment / help on this ?

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using, I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question