Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I tried your code <a href="http://jsfiddle.net/RMYjG/" rel="nofollow">here</a></p> <p>Also, you can try including Migration Plugin from here: <a href="http://jquery.com/download/" rel="nofollow">http://jquery.com/download/</a> Migration will help you use older function with jQuery >1.9</p> <p>It works fine, may be it's the jQuery UI and jQuery version you using aren't compatible or it's something else that's messing it up</p> <p>HTML:</p> <pre><code>&lt;input type="image" id="subtractDate" style="height:30px;width:30px;" src="http://www.designofsignage.com/application/symbol/building/image/600x600/arrow-down-circle.jpg" /&gt; &lt;input type="text" id="datepicker" style="width:220px;border:0" /&gt; &lt;input type="image" id="addDate" style="height:30px;width:30px;" src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRC01Om5stwaQi8a4E2mVnniWabNYdQihXQQ50uv3vP6V-PCePp" /&gt; &lt;div id="dialog-message" title="Message" style="display:none"&gt; &lt;p&gt; &lt;span style="float: left; margin: 0 7px 50px 0;"&gt; &lt;/span&gt; We don&amp;#39;t have a timetable for the date you chose. Please select a date between today and the next 2 months. &lt;/p&gt; &lt;/div&gt; var disabledToolBefore = new Date(); disabledToolBefore.setDate(disabledToolBefore.getDate() - 1); var disabledToolAfter = new Date(); disabledToolAfter.setDate(disabledToolAfter.getDate() + 33); $(function () { $("#datepicker").datepicker({ minDate: -0, maxDate: "+1M +2D", showOn: "button", buttonImage: "calendar.png", buttonImageOnly: true, dateFormat: 'D dd MM yy', showAnim: "clip", beforeShowDay: function (date) { var tooltipDate = "We don&amp;#39;t have a timetable for the date you choose. Please select a date between today and the next 32 days"; if (date.getTime() &lt; disabledToolBefore.getTime() || date.getTime() &gt; disabledToolAfter.getTime()) { return [true, '', tooltipDate]; } else { return [true, '', '']; } } }); $("#datepicker").change(function () { updateDate(); }); $("#addDate").click(function () { addDaysToDate(); }); $("#subtractDate").click(function () { subtractDaysToDate(); }); }); function updateDate() { var today = new Date(); var tomorrow = new Date(); var lastDate = new Date(); var date2 = $('#datepicker').datepicker('getDate'); date2.setHours(0,0,0,0); today.setHours(0,0,0,0); tomorrow.setHours(0,0,0,0); lastDate.setHours(0,0,0,0); tomorrow.setDate(today.getDate()+1); lastDate.setDate(today.getDate()+33); if (date2.getTime() == today.getTime()) { //alert(date2); $('#datepicker').val($('#datepicker').val() + " (TODAY)"); $('#subtractDate').attr("disabled",true); $('#addDate').attr("disabled",false); //$('#subtractDate').attr("src","datedecrementer_gray.png"); //$('#addDate').attr("src","dateincrementer.png"); } else if (date2.getTime() == tomorrow.getTime()) { $('#datepicker').val($('#datepicker').val() + " (TOMORROW)"); $('#subtractDate').attr("disabled",false); $('#addDate').attr("disabled",false); // $('#subtractDate').attr("src","datedecrementer.png"); // $('#addDate').attr("src","dateincrementer.png"); } else if (date2.getTime() == lastDate.getTime()) { //alert(lastDate); //$('#addDate').addClass('newClass'); $('#addDate').attr("disabled",true); $('#subtractDate').attr("disabled",false); // $('#addDate').attr("src","dateincrementer_gray.png"); // $('#subtractDate').attr("src","datedecrementer.png"); } else { $('#addDate').attr("disabled",false); $('#subtractDate').attr("disabled",false); // $('#subtractDate').attr("src","datedecrementer.png"); // $('#addDate').attr("src","dateincrementer.png"); } } function addDaysToDate() { var date2 = $('#datepicker').datepicker('getDate'); date2.setDate(date2.getDate() + 1); $('#datepicker').datepicker('setDate', date2); $('#datepicker').change(); } function subtractDaysToDate() { var date2 = $('#datepicker').datepicker('getDate'); date2.setDate(date2.getDate() - 1); $('#datepicker').datepicker('setDate', date2); $('#datepicker').change(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload