I am trying to set a minDate in a jquery-ui datepicker. The date is retrieved using jquery from a data attribure of a parent node.
<p data-min-date="2015-03-10">Date: <input id="datepicker" type="text"> </p> <script> $("#datepicker").datepicker({ minDate: $(this).closest('p').data('minDate'), dateFormat: 'yy-mm-dd' }); </script> You can check this fiddle to see that the minDate is not considered by the datepicker.
Can you spot what I'm doing wrong?