Home Answers Viewqa JavaScriptQuestions Implementing Digits restriction Using JQuery

 
 


samar
Implementing Digits restriction Using JQuery
1 Answer(s)      2 years and 5 months ago
Posted in : JavaScript Questions

Hi Sir

I have following field in my html form :

<div>Age<input type="text" name="quantity" id="quantity" /></div>

I want to implement two things :

1 if the letter is not digit then display error and don't type anything

2 Age must be between 18 & 35 and it will show error when it is not in between age range.

Please provide code.

View Answers

December 15, 2010 at 12:55 PM


You can implement these two things using ASCII code & parseint method. Code is provided below :

//called when key is pressed in textbox
    $("#quantity").keypress(function (e)  
    { 
    $("#errmsg").hide();
      //if the letter is not digit then display error and don't type anything
      if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
      {
        //display error message
        $("#errmsg").html("&nbsp;&nbsp;Digits Only").show(); 
       return false;
      } 
      });
      $('#quantity').blur(function(a) {
      if((parseInt($("#quantity").val(), 10)<18)) 
      {
      $("#errmsg").html("&nbsp;&nbsp;Age must be greater than 18").show(); 

      }
      if((parseInt($("#quantity").val(), 10)>35)) 
      {
      $("#errmsg").html("&nbsp;&nbsp;Age must be less than 35").show(); 
      }
     });









Related Pages:
Implementing Digits restriction Using JQuery
Implementing Digits restriction Using JQuery  Hi Sir I have.... Please provide code.   You can implement these two things using ASCII code...("&nbsp;&nbsp;Digits Only").show(); return false
java program_big digits multiplication..
java program_big digits multiplication..  i want program about big digits multiplication program using java..plz tel me answer
The easy slider plug-in implementing with numeric boxes
The easy slider plug-in implementing with numeric boxes In this tutorial, we will discuss about implementing 'easySlider' plug in of jQuery... using easySlider function of jQuery. The numeric boxes highlighted according
jquery
jquery  how to display the leaves taken or holidays of the year or half working days in a calendar in some colors to identify the days using jquery plugin
JQuery
JQuery  how to create jquery auto-complete textbox ? in which data...://www.roseindia.net/tutorial/jquery/autoSuggestTextbox.html   thank you for fast reply. when i m using key-down than cursor is not going down.i m not able
The easy Slider plug-in of jQuery
about implementing easySlider plug in of jQuery. In this example, easySlider plug... to left. This effect is implemented using easySlider function of jQuery. You can...;> <head> <title>Easy Slider jQuery Plugin Demo</title>
jQuery Demos
in different file Display current time using jQuery & JSP Selecting element using jQuery. Showing content of a file using JSP & jQuery Calculating square root using JSP & jQuery
JQuery
using url of the doctors, use jquery autocomplete
Form validation Using Jquery Plugin
Form validation Using Jquery Plugin  Hello sir I want to implement form validation using JQuery Plug-in. My code is : <html> <style type...;/form> </body> </html> Please provide me JQuery code regarding
Implementing voice commands
Implementing voice commands  Am trying to write a java program to implement voice commands within a windows platform using preferably java (though any language will do). I would be glad for any tips and procedures that would help
jQuery plugin examples code
:  Form validation using jQuery plug in & JSP The 'innerfade' effect using jQuery plug-in The 'innerfade' effect with "Images" using jQuery plug
implementing an algorithm using multi threads - Java Beginners
implementing an algorithm using multi threads  Hi i need to implement an algorith in multi threads.Algorithm has data dependency so i need to pass data from one thread to another thread. I am posting my algorithm which needs
pdf restriction
pdf restriction  i have certain pdf files that have restrictions on it as copy ,read,extract text etc.. i want to remove restriction by java code. so is there any way to do this? plz help thanks in advance rohit
Implementing a SoftReference based HashMap - Java Tutorial
Implementing a SoftReference based HashMap 2001-03-28 The Java Specialists' Newsletter [Issue 015] - Implementing a SoftReference based HashMap Author... through my "unit" test. Implementing a SoftReference based HashMap
PHP and JQuery
PHP and JQuery  How to make validation using PHP and JQuery
Use of jQuery
Use of jQuery  What is the use of jQuery?   Hi, jQuery is JavaScript Ajax library. Developer is using it to create rich internet applications. Read at jQuery Tutorial. Thanks
jQuery - jQuery Tutorials and examples
created many examples of using jQuery. View the demo's here. Learn jQuery step by step using the following tutorials: Overview of jQuery..., getting, and setting content using jQuery Manipulating attributes
jQuery Tutorials, jQuery Tutorial
, installing and developing first jQuery application Using different features... application using jQuery and JavaScript Don't wait start learning jQuery...jQuery Tutorials, jQuery Tutorial The jQuery tutorials listed here will help
PHP and JQuery
PHP and JQuery  How i validate input fields' data entry using JQuery
Vertical news slider using jquery
Vertical news slider using jquery  how to creatw vertical news slider using jquery Sorry for wrong category but i cant get my jquery category
multiply of 100 digits numbers
multiply of 100 digits numbers  multiplying 100 digits numbers to eachother
jQuery selectors
the elements of page to operate upon with jQuery library methods. For using JQuery... jQuery selectors       jQuery selectors In this tutorial we are discussing jQuery
Html form validation using jquery
Html form validation using jquery  Hi i am using form with html. Form elements like textbox, radio,checkbox,listbox i was used now how to validate the elements using submit jquery option
HTML form validation using jquery
HTML form validation using jquery  Is there any way for validating html elements common under a class by giving its class name in jquery validation code..that means validating all elements by using its class name if those
Implementing ArrayList's functionalities into arrays - Java Beginners
Implementing ArrayList's functionalities into arrays  Hi guys, i'm trying to solve an exercise were is asked to write a program that manages.......ARRAYS! I've already tried to solve it using Arraylists and faced no problems
Sorting data in a jsp using a servlet while implementing comparable - JSP-Servlet
Sorting data in a jsp using a servlet while implementing comparable  Hi Sorry for being not so clear before. I have 3 records in my database. I want to sort them according to their respective headings. Here's the code I have
Using the jQuery Transform plug-in(XSLT)
Using the jQuery Transform plug-in(XSLT)       Using the jQuery Transform plug-in(XSLT... Language Transformations ). The jQuery Plugin we are using
application using AJAX and JQuery and also use JSP
application using AJAX and JQuery and also use JSP   i need create an application using AJAX and JQuery and also use JSP
jQuery Training
and adding jQuery into your project Using jQuery for Ajax request a) jQuery... jQuery Training     jQuery Training for learn jQuery fast The jQuery training is designed to teach
Conflict with jQuery scripts
Conflict with jQuery scripts  Hi, How to avoid Conflict with jQuery scripts while using jQuery with other libraries? Thanks   Hi, Read the using jQuery with other libraries tutorial for more information. Thanks
Disabling submit button using jQuery
Disabling submit button using jQuery  Hello Sir I want to know - is there any way or approach to disable client side form's "Submit" button. Please give code also.   For all submit buttons, via JQuery, it'd
How to write a search functionality using javascript/jquery
How to write a search functionality using javascript/jquery   How to write a search functionality using javascript/jquery for ex: im searching "s" names it wil display "s" names
Using the jQuery event object
Using the jQuery event object       Using the jQuery event object JQuery... to these standards, this system normalize the event object. jQuery. Event
jQuery Features
methods of jQuery. It is using CSS 3.0 syntax which provide us freedom...-ins The jQuery architecture provide us freedom to extend functionality using... jQuery Features      
JQuery-Selecting class or ID
JQuery-Selecting class or ID  Hi Guys, I am new to JQuery. I am getting little trouble in selecting an item using class or ID in jQuery
Find Browser & it's version using jQuery
Find Browser & it's version using jQuery  Hi sir I heard that JQuery have some method which can be used to find the Browser name & its version. I need the code which checks the browser and if it is "Mozilla", it will show
Using the QUnit to test jQuery application
Using the QUnit to test jQuery application       Using the QUnit to test jQuery application Using Qunit , testing of JQuery become very easy and efficient
JQuery as validation controller
is a link that will provide you an example of validating email using jquery. http://www.roseindia.net/ajax/jquery/validate-email-address.shtml... JQuery as validation controller  I would love to use JQuery
Crop image Using JQuery, servlet or JSP.
Crop image Using JQuery, servlet or JSP.  Hi sir I need the code of Cropping image using JQuery with the help of servlet or JSP. I need both the code Client side as well as of server side. Please Help me
Theming JQuery
Theming JQuery       Theming JQuery The jQuery widgets are designed... ,that is, standard jQuery UI CSS Framework styles and plugin-specific
Test hidden element using JQuery
Test hidden element using JQuery  Suppose i have an element which i am hiding and showing, using .hide(), .show() or .toggle().How do you test to see... using following code snippet : $(element).is(":visible") Hope this will helpful
check username availability using JSP & JQuery
check username availability using JSP & JQuery  Hi sir I want check username availability using JSP & JQuery. Please add code with your answer. Thnks in advance
Replace broken Image using JQuery
Replace broken Image using JQuery  Sir My web page contains a lot of images. But when it will not loaded properly, it shows a broken image. How can I fix it so that broken image will be replaced by error image automatically
Explain the process of implementing a CORBA client using a Java programming example and the steps involved.
Explain the process of implementing a CORBA client using a Java programming example and the steps involved.  plz tell me answer of this question... the process of implementing a CORBA client using a Java programming example
JQuery-confirming exsistance of an element.
JQuery-confirming exsistance of an element.  Hi there, How do I test whether an element exists in jQuery?   You can check existance of an element in jQuery using length property of the jQuery collection
jQuery modal popup
jQuery modal popup  i want the full source code for modal popup for registration and inserting the data in the database using jdbc and oracle
Auto grow Text Area using jQuery plug-in
Auto grow Text Area using jQuery plug-in  Hi sir How can we make a textarea auto grow ? What is the name of the plug-in used for auto grow text area. Please mention code with your reply
How to reset a form in jQuery?
How to reset a form in jQuery?  Hi, I have a form where I am using jQuery. I want to reset the form. How I can reset the form grammatically?   Hi, You can use following code: $("#MyFomrName").reset(); Thanks
jQuery Tutorial
events, and develop Ajax applications. Using jQuery we can also develop plug...jQuery Tutorial jQuery is a cross browser, java Script library created by ... more". It handles the client side scripting of HTML. jQuery simplifies 
jquery - JSP-Servlet
jquery  Hi, I need validation script for jquery. I have username,password,port number and directory fields.I need to validate these fields using jquery with jsp. Please send the code for me immediately. Regards

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.