Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

JQuery function not performing as expected

I am new to JQuery and I have a simple page to "play" with JQuery and I can't get this to work.  I simply have an textbox with a submit button on a form.  I wrote a JQuery that is supposed to do an alert everytime a key is pressed.  I'm not getting the alert.  In addition, if the class is set to "no-edit" then it returns false so it shouldn't accept input on the text box.  This isn't working either.  Can someone tell me what I'm doing wrong?  I am not getting any errors on the page and when I debug the page it never enters my JQuery code.  My file exists in a folder c:\my projects\JQuery Test\test.asp;  The JQuery file is in C:\my projectes\libs\jquery\jquery-1.7.2.min.js.  Here is my page: (Any help is greatly appreciated!)

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--  INCLUDES FOR JQUERY -->
<script type="text/javascript" src="/libs/jquery/jquery-1.7.2.min.js"></script>
<script language="JavaScript">
$document.ready(function()
{
      var ctrlDown = false;
      var pasteFlag = false;
      var ctrlKey = 17, vKey = 86;
      
      $(document).keydown(function(e)
      {
            alert("key down");
      }).keyup(function(e)
      {
            alert("Ctrl False");
      });
      
      $(".no-edit").keydown(function(e)
      {
            return false;
      });
});
</script>
<title>JQuery Test</title>
</head>

<body>
<form name="test" method="post" action="test.asp" target="_self">
      <input name="textbox" id="textbox" size="12" class="no-edit" />
      <input name="submit" id="submit" type="submit" value="Submit" />
</form>
</body>
</html>
0
dyarosh
Asked:
dyarosh
1 Solution
 
leakim971PluritechnicianCommented:
replace : $document.ready(function()
by : $(document).ready(function()
0
 
dyaroshAuthor Commented:
Can't tell you how many times I read that line and didn't catch the missing ().  Thank you.
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.

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