Checking numbers from entry using Jquery

advertisements

I am trying to make a function using jquery. And what i am trying to do is that i have a text field and submit button so when i insert numeric value from 1 to 10 it open up a link if the input value is from 11-20 on button click it should open different link.

html

<input type="text" Id="number" />
<input type="submit" id="button" />

jquery

 $( document ).ready(function() {
   if ( $("#number").val() >= 19200 && num <= 19276 ) {
    $( "#button" ).click(function() {
      alert( "u enterd the number " );
    });
   }
 });

http://jsfiddle.net/2nppc/1/


You're going to need something along these lines:

$(document).ready(function(){
    $('#button').click(function(){
         var number = $('#number').val();
         //check if number
         if($.isNumeric(number)){
             if(number >= 1 && number <= 10){
                 //1-10 action
             }elseif(number >= 11 && number <= 20){
                 //11-20 action
             }
         }else{
             //Not a number
         }
    });
});

EDIT: sorry mixed up the format for checking numeric, sorted now :)