gpt4 book ai didi

javascript - Bootstrap datepicker多个日期选择器不断返回 "Please enter a valid date."

转载 作者:行者123 更新时间:2023-12-01 00:44:22 24 4
gpt4 key购买 nike

我正在使用 Bootstrap 多选日期选择器

HTML5:

 <div class="form-group ">
<label for="unavailable_date" class="control-label col-lg-2" >unavailable date list</label>
<div class="col-lg-10">
<input type="text" id="unavailable_date" class="form-control date" placeholder="unavailable date list">
</div>
</div>

JS

 $('.date').datepicker({
multidate: true,
format: 'dd-mm-yyyy'
});

enter image description here

每当我单击提交按钮时,验证消息就会出现并中断该过程,我如何禁用此元素的验证?

最佳答案

$('.date').datepicker({
multidate: true,
format: 'dd-mm-yyyy'
});


$('#onSubmit').click(function(){
var selectDate = $("#unavailable_date").val();
console.log(selectDate);
});
<html>

<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
</head>

<body>

<div class="form-group ">
<label for="unavailable_date" class="control-label col-lg-2" >unavailable date list</label>
<div class="col-lg-10">
<input type="text" id="unavailable_date" class="form-control date" placeholder="unavailable date list">
</div>
</div>

<div class="form-group">
<button id="onSubmit" class="btn btn-primary" >Submit</button>
</div>

</body>

</html>

你可以试试这个

关于javascript - Bootstrap datepicker多个日期选择器不断返回 "Please enter a valid date.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57511172/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com