Resetting a multi-stage form with jQuery

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

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


Trouble i

30条回答
  •  不知归路
    2020-11-22 01:20

    I was having the same problem and the post of Paolo helped me out, but I needed to adjust one thing. My form with id advancedindexsearch only contained input fields and gets the values from a session. For some reason the following did not work for me:

    $("#advancedindexsearch").find("input:text").val("");
    

    If I put an alert after this, I saw the values where removed correctly but afterwards they where replaced again. I still don't know how or why but the following line did do the trick for me:

    $("#advancedindexsearch").find("input:text").attr("value","");
    

提交回复
热议问题