在我的表单中,我想使用新的HTML5表单类型,例如<input type="url" />(有关这里类型的更多信息).
The problem is that Chrome wants to be super helpful and validate these elements for me, except that it sucks at it. If it fails the built-in validation, there's no message or indication other than the element getting focus. I prefill URL elements with "http://", and so my own custom validation just treats those values as empty strings, however Chrome rejects that. If I could change its validation rules, that would work …
我有这样的 HTML 代码:
<input type="number" step="0.1" class="form-group">
Run Code Online (Sandbox Code Playgroud)
我希望用户能够输入 3 位十进制数字,1.234但step需要这样,0.1它会引发错误并阻止表单提交。
我已经尝试过了step="0.100",但结果是一样的。
我还需要验证其他输入,这样我就无法no validate在<form>标签中使用。
需要做什么?