From: Anthony Talarico Date: Mon, 2 Nov 2015 21:41:20 +0000 (-0500) Subject: Attempting mobile phone validation with js X-Git-Tag: v1.0.0^2~34 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=c43718af3ed0444d60d946d3a43441bdd2ccb94c;p=WP-Themes%2Fbpla.git Attempting mobile phone validation with js --- diff --git a/js/app.js b/js/app.js index c3d1e8b..14c170a 100644 --- a/js/app.js +++ b/js/app.js @@ -70,10 +70,10 @@ $(document).ready(function () { // restrict datepicker for days after current date and 2 days after that date [min] $("#dateOff1").change(function () { - today = $("#dateOff1").val(); - today = new Date(today); + currentDate = $("#dateOff1").val(); + today = new Date(); minDays = 2; - today.setDate(today.getDate()); + today.setDate(today.getDate() + minDays); d = today.getDate(); if (d <= 9) { d = '0' + d; @@ -84,8 +84,10 @@ $(document).ready(function () { } y = today.getFullYear(); requiredDate = y + '-' + m + '-' + d; - $("#dateOff1").val(""); - $("#dateOff1").val(requiredDate); + if (currentDate !== requiredDate) { + alert("bo"); + } + }); $("#date1").datepicker({ diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index b514f78..70b46f4 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -61,10 +61,10 @@ $(document).ready(function () { // restrict datepicker for days after current date and 2 days after that date [min] $("#dateOff1").change(function () { - today = $("#dateOff1").val(); - today = new Date(today); + currentDate = $("#dateOff1").val(); + today = new Date(); minDays = 2; - today.setDate(today.getDate()); + today.setDate(today.getDate() + minDays); d = today.getDate(); if (d <= 9) { d = '0' + d; @@ -75,8 +75,10 @@ $(document).ready(function () { } y = today.getFullYear(); requiredDate = y + '-' + m + '-' + d; - $("#dateOff1").val(""); - $("#dateOff1").val(requiredDate); + if (currentDate !== requiredDate) { + alert("bo"); + } + }); $("#date1").datepicker({