skip to Main Content

input type date format should be 12-mar-23 even if user type 12-03-23 – Jquery

(function() { $('#submit').on('click', function(){ var date = new Date($('#date-input').val()); day = date.getDate(); month = date.getMonth() + 1; year = date.getFullYear(); alert([day, month, year].join('/')); }); })(); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input type="date" id="date-input" required /> <button id="submit">Submit</button> In input date, format should be…

VIEW QUESTION
Back To Top
Search