-1
我正在對MVC項目,我想使用日期選擇器彈出日曆。但它不起作用。這裏是我的代碼:javascript日期選擇器彈出式日曆不在MVC工作
<script>
$(document).ready(function() {
$('#datetimepicker').datetimepicker({
yearOffset: -15,
lang: 'en',
timepicker: false,
format: 'm/d/Y',
formatDate: 'Y/m/d',
// minDate: '1940/01/02', // yesterday is minimum date
// maxDate: '2000/01/02' // and tommorow is maximum date calendar
});
});
</script>
VIEW
<div class="col-md-3">
<label class="control-label" style="font-family:Arial, Helvetica, sans-serif; font-size:13px;margin-top:6px;">
Date Of Birth<b style=" color:#ff0000;">*</b>
</label>
</div>
<div class="col-md-3" style="left:-25px;">
@Html.TextBoxFor(a => a.DOB, new { Class = "form-control ", placeholder = "Date of Birth", id = "datetimepicker", TextMode = "date", value = "01/11/1989", maxlength = "20", style = "width:175px;height:25px;font-size:small;" })
@Html.ValidationMessageFor(a => a.DOB)
</div>
什麼不起作用?瀏覽器控制檯中有哪些錯誤?正如你以前一再被告知的那樣 - 它的'@ class =「form-control」'和'TextMode =「date」'是無效的,你不應該設置'value'屬性(設置屬性'DOB'的值你將模型傳遞給視圖) –
是啊我通過模型 – Codeone
DOB你是什麼意思不工作?你在控制檯中收到任何錯誤嗎? –