Note that there are some explanatory texts on larger screens.

plurals
  1. POHidden value changed, datepicker will reload
    text
    copied!<p>I have a question on how to make sure whenever this hidden value changed, the datepicker will reload. Because the datepicker will used the hidden value to highlight the days. So whenever the hidden value changed, the highlighted days in datepicker also will change.</p> <p>Here my code so far. <code>$("#dates").val()</code> is a hidden value. sample of the value is <code>2013/11/11-2013/11/17</code>. This value will highlight the whole week (mon-sun). There's a previous and next button, which will changed the <code>$("#dates").val()</code> by week eg: 2013/11/18-2013/11/24, 2013/11/25-2013/12/1</p> <p>I have no problem to trigger if the hidden value is changed, the problem is I want the datepicker to reload once the hidden value changed. so that the highlighted week while changed accordingly. currently whenever the hidden value change, the highlighted week will remain the same.</p> <p>I did try to used <code>$( "#datepicker" ).datepicker( "refresh" );</code> whenever the hidden value changed, but still no luck. Please help me. Thanks</p> <pre><code>$(document).ready(function() { var dates = $("#dates").val(); var lt = dates.split("-"); var ts = lt[0].split("/"); var te = lt[1].split("/"); var date1 = new Date(ts[0], ts[1]-1, ts[2]); var date2 = new Date(te[0], te[1]-1, te[2]); $(function(){ $('#datepicker').datepicker({ dateFormat: 'yy/mm/dd', beforeShowDay: highlightDays, onSelect: function(dateText, inst) { $("#showdaybtn").addClass("fcurrent"); $("#showweekbtn").removeClass("fcurrent"); $("#showmonthbtn").removeClass("fcurrent"); $('#type').val('1'); var p = $("#gridcontainer").swtichView("day").BcalGetOp(); if (p &amp;&amp; p.datestrshow) { $("#txtdatetimeshow").text(dateText); $("#hdnTempData").val(dateText); } showhideToday('day'); glbView = "day"; } }); function highlightDays(date) { if (date &gt;= date1 &amp;&amp; date &lt;= date2) { return [true, 'highlight', 'tooltipText']; } return [true, '']; } }); }); //to check if the hidden value changed $(document).on('change', '#dates', function () { $( "#datepicker" ).datepicker( "refresh" ); }); </code></pre>
 

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