最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - clear input filed when clear button is pressed in Django - Stack Overflow

programmeradmin0浏览0评论

i have an input field in django html file and a clear button and i want to clear the input filed when the clear button is pressed. how can it be done? do i need to know javascript for that or it can be done otherway?

  <form>
    <input type="text" id="textfield1" size="5">
    <input type="text" id="textfield2" size="5">
    <input type="reset" value="Reset">
    </form>

i have an input field in django html file and a clear button and i want to clear the input filed when the clear button is pressed. how can it be done? do i need to know javascript for that or it can be done otherway?

  <form>
    <input type="text" id="textfield1" size="5">
    <input type="text" id="textfield2" size="5">
    <input type="reset" value="Reset">
    </form>
i want to clear only one field not both

Share Improve this question asked Jun 27, 2017 at 2:46 NamelessNameless 5234 silver badges23 bronze badges 1
  • 3 Without reloading the page, you will need to use some JavaScript to do this. – perfect5th Commented Jun 27, 2017 at 2:47
Add a ment  | 

1 Answer 1

Reset to default 5

This is just a simple thing :

<input type="button" value="Reset" id="resetBtn" onClick="this.form.reset()" />

Regarding to :

http://javascript-coder./javascript-form/javascript-reset-form.phtml
发布评论

评论列表(0)

  1. 暂无评论