[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 689
  • Last Modified:

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

0
t3ch
Asked:
t3ch
  • 2
2 Solutions
 
wuffCommented:
You are missing $('..'). Try to add'em:

var myval = $('#serialInput').val();
alert(myval);

0
 
amischolCommented:
I agree with wuff
0
 
t3chAuthor Commented:
Hi Wuff,

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

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

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

0
 
t3chAuthor Commented:
Thanks
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now