[英]dynamic mindate based on data-attribute for jquery datepicker
I have an input element 我有一个输入元素
<input id="order_neediton" class="form-control hasDatepicker" type="date" name="order[neediton]" data-notice="3">
and the jquery datepicker like so 和jquery datepicker这样
$(function() {
$("#order_neediton").datepicker({ constrainInput: false , maxDate: "+1m", minDate: "{$('#order_neediton').attr('data-notice')}d"});
});
so as to have the miniumum date start 3 days from today. 以使最短的日期从今天开始3天。
But it does not work, how should I go about doing it? 但这不起作用,我应该怎么做呢?
Try with this 试试这个
$(function () {
var min = $('#order_neediton').attr('data-notice');
$("#order_neediton").datepicker({
constrainInput: false,
maxDate: "+1m",
minDate: min + "d"
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.