Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7499811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:57:17+00:00 2026-05-29T19:57:17+00:00

Following is the simple jQuery function but I couldn’t figure it out. <html> <head>

  • 0

Following is the simple jQuery function but I couldn’t figure it out.

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Screen Class</title>

<script type="text/javascript" language="javascript"> 

   //<![CDATA[
   function getFocus()
   {               
        document.getElementById("txtScreenClassCode").focus();                
   }  

   $(document).ready(function() 
   {                            
        $("#txtScreenClassCode").keypress(function(event) 
        {                                
            if (event.keyCode==46 || event.keyCode==8|| event.keyCode==9 || event.keyCode>=35 && event.keyCode<=40) 
            {
                // let it happen, don't do anything                       
            }
            else 
            {                               
                if (event.charCode<48 || event.charCode>57 || event.charCode==16) 
                {                            
                        event.preventDefault(); 
                }       
            }                  
        });
    });
   //]]>
</script>

</head>
<body onload="getFocus();">

<input type="text" id="txtScreenClassCode"  
    name="txtScreenClassCode"style="background-color: white">

</body>
</html>

In the above code the jQuery function $(document).ready(function() doesn’t work. It is meant to allow only digits in the TextField mentioned. The browser shows an error at the beginning of this function i.e on this line itself $(document).ready(function() that indicates that Object expected. What should be wrong with this function? I have teated it with IE and Mozilla Firefox and I also tried to put it into a different directory and enclosed it within the CDATA tag but not to avail.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:57:18+00:00Added an answer on May 29, 2026 at 7:57 pm

    You need to include jQuery library on the page.

    If you don’t have jQuery in your application you can include it from one of the jQuery CDN’s mentioned here http://www.jquerycdn.net

    If you don’t know how to include jQuery just add this script tag inside the head section of your page markup.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    

    This will include jQuery 1.7 minified js file from Google Ajax API CDN

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following sliding div script: http://www.webdesignerwall.com/demo/jquery/simple-slide-panel.html Currently, the slidetoggle function is
I have the following Javascript/jQuery function: function addEventHandler(){ $(div).mouseenter(function() { $(this).html(Over); }).mouseleave(function() { $(this).html(Out);
http://jsfiddle.net/JamesKyle/y7hBQ/ I'm making a simple jquery counting function that adds the following classes: First
Still new to jQuery, need help on following: <!DOCTYPE html> <html lang=en> <head> <meta
I am following the steps given here http://wordpressthemescollection.com/simple-modal-google-map-easy-modal-map-boxes-with-jquery-752.html to display a Google map in
I'm following the tutorial here: http://docs.jquery.com/Plugins/Authoring I just wanted to create a simple plugin
I have the following simple function: private void EnableDisable941ScheduleBButton() { if (this._uosDepositorFrequency.Value != null)
This is probably a really simple one but I couldn't find the answer. I
Ive been writing a simple jquery function that turns a div with a list
I'm trying to use the following plugin for date picking: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html And I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.