Solved

Issue with jQuery keydown

Posted on 2010-09-21
4
676 Views
Last Modified: 2012-08-13
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
Comment
Question by:t3ch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
wuff earned 450 total points
ID: 33729912
You are missing $('..'). Try to add'em:

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

0
 
LVL 2

Assisted Solution

by:amischol
amischol earned 50 total points
ID: 33730074
I agree with wuff
0
 
LVL 4

Author Comment

by:t3ch
ID: 33730588
Hi Wuff,

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

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

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

0
 
LVL 4

Author Closing Comment

by:t3ch
ID: 33978221
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question