Search
 
SCRIPT & CODE EXAMPLE
 

HTML

disable dates before today in input type date

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
        window.onload=function(){
          //from www.java2s.com
          var today = new Date().toISOString().split('T')[0];
          document.getElementsByName("setTodaysDate")[0].setAttribute('min', today);
      }
      </script> 
   </head> 
   <body> 
      <input name="setTodaysDate" type="date">  
   </body>
</html>
Comment

html set input type date to disable previous dates

$(function(){
    var dtToday = new Date();
    
    var month = dtToday.getMonth() + 1;
    var day = dtToday.getDate();
    var year = dtToday.getFullYear();
    if(month < 10)
        month = '0' + month.toString();
    if(day < 10)
        day = '0' + day.toString();
    
    var maxDate = year + '-' + month + '-' + day;
    alert(maxDate);
    $('#txtDate').attr('min', maxDate);
});
Comment

disable past date in inpit date picker

$(function(){
    var dtToday = new Date();
    
    var month = dtToday.getMonth() + 1;
    var day = dtToday.getDate();
    var year = dtToday.getFullYear();
   
    $('#txtDate').attr('min', maxDate);
});
Comment

PREVIOUS NEXT
Code Example
Html :: controls in html list 
Html :: javascript timespan 
Html :: lit element double click 
Html :: klaviyo.js snippet 
Html :: data component attribute 
Html :: tag to custom theme 
Html :: how to keep audio in the web html 
Html :: mp4 start time html 
Html :: How to group form inputs 
Html :: Error: Stray start tag script. 
Html :: html button ondrag 
Html :: view uava code in html 
Html :: Cambiar el texto de label usando Jquery 
Html :: html strike tag customize 
Html :: add .class to another class html 
Html :: pulsating icons 
Html :: html5 tutorial 
Html :: meta - sendMessage 
Html :: physical and logical tags in html 
Html :: how to add vertical space between two text boxes in html 
Html :: Tabbable nav 
Html :: myTeam 
Html :: sum total free html code 
Html :: inject modal to page through extension 
Html :: number paragraphs in html 
Html :: input button in html 
Html :: How many script tags can you add in a html file? 
Html :: how to align a section center in html 
Css :: hide scrollbar css 
Css :: how to center placeholdr text 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =