Resetting a multi-stage form with jQuery

前端 未结 30 2038
谎友^
谎友^ 2020-11-22 00:58

I have a form with a standard reset button coded thusly:


Trouble i

30条回答
  •  忘了有多久
    2020-11-22 01:40

    From http://groups.google.com/group/jquery-dev/msg/2e0b7435a864beea:

    $('#myform')[0].reset();
    

    setting myinput.val('') might not emulate "reset" 100% if you have an input like this:

    
    

    Eg calling myinput.val('') on an input with a default value of 50 would set it to an empty string, whereas calling myform.reset() would reset it to its initial value of 50.

提交回复
热议问题