Link to home
Start Free TrialLog in
Avatar of t3ch
t3chFlag for Afghanistan

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?
<script language="javascript">
$(function()
{
  $('.scroll-pane').jScrollPane();
});


$(document).keydown(function() {
   $('#serialInput').focus(); 
   $('#serialInput').keyup(function() {
     
	 alert(#serialInput.val());
   
   )};
  
});


</script>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of wuff
wuff

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of t3ch

ASKER

Hi Wuff,

                Its working now. Thanks. but what I changed was:

                       alert(#serialInput.val());
      )};
 
                to:

              alert(#serialInput.val());
     });
 

Avatar of t3ch

ASKER

Thanks