小编A. *_*ias的帖子

jQuery validation fails when putting step="1" in a "datetime-local" input type

I'm using https://jqueryvalidation.org/ form validation plugin

When I put step="1" in a datetime-local input field to show seconds, if I'm validating that field with the plugin (just "required", for example), I get a javascript error saying "Step attribute on input type datetime-local is not supported". If I put this step="1" in a field that is not being validated, it works without problems.

$("#testingform").validate();
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.17.0/dist/jquery.validate.min.js"></script>
<form id="testingform">
    <input type="datetime-local" step="1" name="date1" required>
    <button type="submit">Send</button>
</form>
Run Code Online (Sandbox Code Playgroud)

... just put …

validation jquery jquery-validate

5
推荐指数
1
解决办法
2176
查看次数

标签 统计

jquery ×1

jquery-validate ×1

validation ×1