使用OnBlur验证输入类型=文件
-
09-12-2019 - |
题
我能够使用OnBlur来验证类型= text= text或textarea输入,但是我还没有能够为type= file工作。
此工作:
<input type='text' name='sometextfield' size=30 class='input' onBlur="alert('Frell me dead, it works!');"
.
这不是(没有错误):
<input type='file' name='file_upload' size=30 class='input' onBlur="alert('Frell me dead, it works!');">
.
验证类型=文件输入框的技巧是什么?我想在vanilla javascript中这样做。我在Ubuntu下使用Chrome 17.0.963.56和Firefox 10.0.2测试。
感谢提示/指针。
解决方案
尝试使用onchange-event:
<input type="file" name="file_upload" size="30" class="input" onchange="alert('Frell me dead, it works!');">
.
不隶属于 StackOverflow