html - oninput()在选择上不起作用

标签 html

我在oninput="setCustomValidity('')标记上完美地使用了这个input,但是它似乎在select标记中不起作用。这在select标记中有效吗?

<select class="dropdownlist" required oninvalid="this.setCustomValidity('Please select Accused Name')" oninput="setCustomValidity('')">

最佳答案

只是否,不适用于select
如果要检测oninput()textareainput:textinput:password元素的内容何时更改,则input:search很有用,因为这些元素上的onchange事件在元素失去焦点时触发,而不是在修改后立即触发。

因此,使用onchange()作为替代品!

希望这会有所帮助

关于html - oninput()在选择上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22563544/

相关文章:

javascript - window.open 在 Firefox 中无法正常工作

javascript - Chrome 扩展弹出窗口打不开

JavaScript:如何检测是否选中了 HTML 复选框?

javascript - 'generated' 属性在哪里是允许的?

java - JTextPane 中的 HTML 表格显示奇怪的 "form"框

php - yii2 : make checkbox to be checked

html - 为什么我的平板媒体查询没有激活?

html - 允许在 wordpress 简码内容中使用 HTML 标签吗?

html - 我想让文本稍微居中,但它跳到一个新行

javascript - Bootstrap - 让元素在两列布局中显示为 block ,而不是分成两列