PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, March 14, 2022

[FIXED] Jquery Datepicker not rhiding past dates

 March 14, 2022     codeigniter, jquery, jquerydatetimepicker, php     No comments   

Issue

Am using Jquery Datepicker for my project . If i want to change date format my code will be

$( "#datepicker1" ).datepicker({
  dateFormat: "dd-mm-yy"
});

Its not working . But if am using this format its working

$("#datepicker1").datepicker("setDate", '+1d');

Please provide me a solution . Thanks in Advance


Solution

To disable all previous dates, give start date as today date

startDate: new Date()

$(function() {
    $( "#datepicker" ).datepicker({ 
      format: 'dd/mm/yyyy',
      startDate: new Date(),
    });
 });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datepicker/0.6.5/datepicker.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/datepicker/0.6.5/datepicker.min.css" rel="stylesheet"/>


<div> Select Date <input type="text" id="datepicker" /></div>



Answered By - Vipul L.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing