can please tell me how block selecting future date in type="date".in query mobile? have button (+) on header .on clicking open pop screen .there date field .i need block or hidden future date in date picker(type="date").
here fiddle http://jsfiddle.net/gajotres/7jqrg/6/
$(document).on('pagebeforeshow', '#home', function(){ $(document).on( "popupafteropen", "#caseinformationscreen",function( event, ui ) { var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+"-"+(month)+"-"+(day) ; $('#casedate').val(today); }); });
working example: http://jsfiddle.net/gajotres/7jqrg/9/
$(document).on('pagebeforeshow', '#home', function(){ $(document).on( "popupafteropen", "#caseinformationscreen",function( event, ui ) { var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+"-"+(month)+"-"+(day) ; $('#casedate').attr('max', today); $('#casedate').val(today); }); }); reference documentation: http://html5doctor.com/html5-forms-input-types/
unfortunately because max , min don't work on ios here's javascript solution problem: http://jsfiddle.net/gajotres/7jqrg/10/
var datecontroler = { currentdate : null } $(document).on('pagebeforeshow', '#home', function(){ $(document).on( "popupafteropen", "#caseinformationscreen",function( event, ui ) { var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+"-"+(month)+"-"+(day) ; $('#casedate').val(today); datecontroler.currentdate = today; }); $(document).on( "change", "#casedate",function( event, ui ) { var = new date(); var selecteddate = new date($(this).val()); if(selecteddate > now) { $(this).val(datecontroler.currentdate) } else { datecontroler.currentdate = $(this).val(); } }); });
Comments
Post a Comment