JavaScript

Showing posts with label datepicker. Show all posts
Showing posts with label datepicker. Show all posts

Monday, 16 April 2012

How to validate date through Jquery






Submit



date validation through jquery......................


$("#Text3").datepicker({numberOfMonths:2,
     showButtonPanel: true,
     dateFormat:'dd/mm/yy',
     autoSize: true,
    
     maxDate: '+3m',
     Image:"image.axd.jpeg",
     showOn: 'both'
    
  
     });
     $("#button").click(function(){
     //alert("hello");
     var dateformat= document.getElementById("Text3");
     var splitvaue= dateformat.value.split('/');
    
     var date= new Date();
     alert(date.getMonth()+1);
    
    // if((parseInt(splitvaue[0])>=date.getDate())&&(parseInt(splitvaue[1]))>=(date.getMonth()+1)){
if(parseInt(splitvaue[1])<13 && parseInt(splitvaue[0])<=31){
    if(parseInt(splitvaue[2])==(date.getFullYear())) {
        alert("hello");
     }
}
     else
     {
     alert("should be enter Today Date");
     }
   
         });
     });