我想使用百里香叶在我的日期选择器中设置一个最小的可选日期。
我尝试通过以下代码进行设置:
<label th:utext="#{${name}}" th:for="${name}" class="control-label"></label>
<div class="input-group input-group-prepend">
<span class="input-group-text far fa-calendar-alt"></span>
<input type="text" th:id="${name}" th:name="${name}" th:value="${value}" th:placeholder="${placeholder}" class="form-control" onfocus="(this.type='date')" min="${minDate}"/>
</div>
但是此代码
min="${minDate}"
被忽略。有一种方法可以使用
thymeleaf
进行操作,还是只能通过javascript
进行?谢谢
最佳答案
您可以尝试如下使用th:attr
th:attr="min=${minDate}"
关于javascript - Thymeleaf和DatePicker:设置最小日期,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49485518/