JQuery Keypress events not working assistance needed

I am working on a piece of code where I have a html input and on page load I need JQuery to :

1. Focus of the Input (This works)

2. Press the DownKey

3. Press Enter Key

Parts 2 and 3 do not work.

I'm basically trying to get the email history list dropdown to appear automatically but no luck.

Here is the full current code:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>


<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

<script type="text/javascript">

 $(document).ready(function(){

$( "#email" ).focus();

$('#email').trigger(jQuery.Event('keypress', {which: 50}));

$('#email').trigger(jQuery.Event('keypress', {which: 13}));
   

 });

</script>


</head>
<body>

 <form>
  Email:<input type="text" id="email" name="email" />
 </form>
 
</body>
</html>

Open in new window

LVL 1
error2013Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

COBOLdinosaurCommented:
What you are trying to do would require taking control of the user interface, and I think you would have to go into the core browser code to add an interrupt to simulate the events. Even if you managed to do that it would probably trigger the AV to alert that the page contains malicious code.

Cd&
0
error2013Author Commented:
When you go to an email form input on a page you can get a dropdown list of emails that you've used ... I'm just trying to automatically open that .. that's all.

It's for personal use so not trying to get silly code there ... just trying to get that  list to open.
0
GaryCommented:
While you can simulate clicks etc on an object you can not emulate those actions
i.e. You can simulate a click on a dropdown but it will not open the dropdown
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

COBOLdinosaurCommented:
If doing it automatically saves yoi 10 seconds a day, the total effort to change the behaviour would be such that break even would be somewhere around 10, 000 years, and ther is no guarantee you can actually get it to work right unless you write a custom browsers.  You'll just have to take my word for that.  I have spent some time in those depths and it is not something you want to try unless you are very experienced working at the primitive level.

Cd&
0
error2013Author Commented:
So are you are telling me that it just cannot be done?
0
GaryCommented:
Yes
0
COBOLdinosaurCommented:
So are you are telling me that it just cannot be done?

With unlimited financial resources and unlimited time, anything can be done.

So if you are Warren Buffet and are not in a hurry you might be able to hire someone to do it before global warming melts the Greenland ice sheet.

Cd&
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.