t3ch
asked on
Issue with jQuery keydown
Hi folks,
I tried to bind an keydown event to the document, along with adding jScrollPane plugin.
On keydown I wanted to move the focus to the input field (this was working fine), but later on I want to send this data to the server, so I added another keyUp event which would trigger the ajax call (code not present, instead I just put a alert box).
After adding this alert box code, my code isnt working. Also in order to send whatever was read through the input to the server, do I need to enclose the INPUT tag in a form?
I tried to bind an keydown event to the document, along with adding jScrollPane plugin.
On keydown I wanted to move the focus to the input field (this was working fine), but later on I want to send this data to the server, so I added another keyUp event which would trigger the ajax call (code not present, instead I just put a alert box).
After adding this alert box code, my code isnt working. Also in order to send whatever was read through the input to the server, do I need to enclose the INPUT tag in a form?
<script language="javascript">
$(function()
{
$('.scroll-pane').jScrollPane();
});
$(document).keydown(function() {
$('#serialInput').focus();
$('#serialInput').keyup(function() {
alert(#serialInput.val());
)};
});
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
ASKER
Its working now. Thanks. but what I changed was:
alert(#serialInput.val());
)};
to:
alert(#serialInput.val());
});