2

im using this jQuery form validation plugin and I came across a difficulty, I have 3 select boxes [Day] [Month] [Year], its for d.o.b so I need to count is the user older than 13, but I just cant figure out how to do it, maybe someone else had a similar difficulty?

user709691
  • 43
  • 1
  • 8
  • I think you could use this example, but it needs a bit of adaptation: http://stackoverflow.com/questions/542938/how-do-i-get-the-number-of-days-between-two-dates-in-jquery – iozee Jun 08 '12 at 08:20

1 Answers1

1

i thing you will search for this

   $("#id").validate({
   submitHandler: function (a) {
        var months;
        var d1=new Date($('#selectbox1').val(),$('#selectbox2').val()-1,$('#selectbox3').val()); // YYYY,MM,DD
        var d2= new Date();
        months = (d2.getFullYear() - d1.getFullYear()) * 12;
        months -= d1.getMonth() + 1;
        months += d2.getMonth();
        if((months/12)>13){
            /* write your coding here*/
        }else{
            alert('enter your message here');
        }
     },
     rules: {

    /* your rules*/

      }

});
Muthukumar M
  • 1,138
  • 10
  • 19