【发布时间】:2014-06-12 09:45:27
【问题描述】:
Chrome 似乎没有以我期望的方式验证 <select>。
如果我选择第一个选项,而 chrome 选择第二个选项,Firefox 会正确返回 false。这在 Windows 和 Linux 上都会发生。
我的 HTML
<form>
<select name="select-choice" id="select-choice" required>
<option value="">This is just a placeholder, it should invalidate the form</option>
<option value="choice2">Choice 2</option>
<option value="choice3">Choice 3</option>
</select>
</form>
我的 JS
$('form').change(function(){
$('.result').html('form is ' + this.checkValidity());
});
CodePen
【问题讨论】:
标签: javascript forms validation google-chrome html-select