Solved

Issue with jQuery keydown

Posted on 2010-09-21
4
673 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
  • 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

777 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