开发者

html reset doesn't work with javascript

I'm having a drop down with onChange event which will call the javascript method.

but when I change to some value 开发者_如何学编程and clicking reset , its reset to orignial value, but the onChange javascript event is not calling.

<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...


I believe you should be using the onchange event. I've never heard of the valueChange event.

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. See here for more info. This is a simple example, which requires two Javascript functions, formReset and selectChanged.

<form onreset="formReset">
    <select id="s" onchange="selectChanged">
        <option>Hello</option>
        <option>World</option>
    </select>
    <input type="reset" />
</form> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜