Search
 
SCRIPT & CODE EXAMPLE
 

HTML

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 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

How to disable previous dates in date in html

<html>
    <head>
    <title>How to disable previous dates in date picker using JQuery - devnote.in</title>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.2.min.js"></script>
</head>
<body>
    <h1>How to disable previous dates in date picker using JQuery</h1>
    Date : <input id="date_picker" type="date">
    <script language="javascript">
        var today = new Date();
        var dd = String(today.getDate()).padStart(2, '0');
        var mm = String(today.getMonth() + 1).padStart(2, '0');
        var yyyy = today.getFullYear();

        today = yyyy + '-' + mm + '-' + dd;
        $('#date_picker').attr('min',today);
    </script>
</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Html :: links in html 
Html :: html ms-text-size-adjust 
Html :: html hoover text 
Html :: input audio and video in html 
Html :: textarea bootstrap 
Html :: storybook fonts 
Html :: SVG <line 
Html :: display html django template 
Html :: meta for author 
Html :: variables in url_for flask jinja 
Html :: multiple countdown html js 
Html :: color picker js 
Html :: hmtl image import 
Html :: select set selected value html 
Html :: selenium click not working 
Html :: change source of iframe attribute target 
Html :: which is right <hr or <hr/ in html 
Html :: how do i link back out a folder using th a-href tag 
Html :: in html the color for red 
Html :: html get user screen resolution 
Html :: html game 
Html :: React Css Class Module 
Html :: how to select only one checkbox in html 
Html :: html input address 
Html :: bootstrap tab 
Html :: html date min today 
Html :: html to exe 
Html :: search button inside search box 
Html :: how to make a calendar using html and css and javascript 
Html :: confirmed button bootstrap 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =