error2013
asked on
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:
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>
ASKER
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.
It's for personal use so not trying to get silly code there ... just trying to get that list to open.
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
i.e. You can simulate a click on a dropdown but it will not open the dropdown
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&
Cd&
ASKER
So are you are telling me that it just cannot be done?
Yes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cd&