Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Issue with jQuery keydown

Posted on 2010-09-21
4
Medium Priority
?
688 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 1800 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 200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

782 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