相关疑难解决方法(0)

禁用HTML5表单元素的验证

在我的表单中,我想使用新的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 …

forms validation html5 input

411
推荐指数
8
解决办法
28万
查看次数

HTML 输入类型=数字 步骤阻止表单提交

我有这样的 HTML 代码:

<input type="number" step="0.1" class="form-group">
Run Code Online (Sandbox Code Playgroud)

我希望用户能够输入 3 位十进制数字,1.234step需要这样,0.1它会引发错误并阻止表单提交。

我已经尝试过了step="0.100",但结果是一样的。

我还需要验证其他输入,这样我就无法no validate<form>标签中使用。

需要做什么?

html javascript

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

标签 统计

forms ×1

html ×1

html5 ×1

input ×1

javascript ×1

validation ×1