[英]html reset doesn't work with javascript
I'm having a drop down with onChange event which will call the javascript method. 我正在使用onChange事件下拉调用javascript方法。
but when I change to some value and clicking reset , its reset to orignial value, but the onChange javascript event is not calling. 但当我更改为某个值并单击重置时,其重置为原始值,但onChange javascript事件未调用。
<select onChange="method1()">
<option>....
</select>
<input type="reset" value="reset" />
After click the reset button, the value is setting to old value but the onChange event is not working... 单击重置按钮后,该值设置为旧值但onChange事件不起作用...
I believe you should be using the onchange event. 我相信你应该使用onchange事件。 I've never heard of the
valueChange
event. 我从来没有听说过
valueChange
事件。
Updated for question edit: 更新了问题编辑:
You will need to add a method to the onreset
event of your form
tag in order for you to run Javascript when your reset button is clicked. 您需要在
form
标记的onreset
事件中添加一个方法,以便在单击重置按钮时运行Javascript。 See here for more info. 有关详细信息,请参见此处 This is a simple example, which requires two Javascript functions,
formReset
and selectChanged
. 这是一个简单的例子,它需要两个Javascript函数,
formReset
和selectChanged
。
<form onreset="formReset">
<select id="s" onchange="selectChanged">
<option>Hello</option>
<option>World</option>
</select>
<input type="reset" />
</form>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.