[removed] True form reset for hidden fields

前端 未结 10 1635
臣服心动
臣服心动 2020-12-14 17:12

Unfortunately form.reset() function doesn\'t reset hidden inputs of the form. Checked in FF3 and Chromium.

Does any one have an idea how to do the reset for hidden f

10条回答
  •  独厮守ぢ
    2020-12-14 17:45

    $('#form :reset').on('click',function(e)({
        e.preventDefault();
        e.stopImmediatePropagation();
        $("#form input:hidden,#form :text,#form textarea").val('');
    });
    

    For select, checkbox, radio, it's better you know (hold) the default values and in that event handler, you set them to their default values.

提交回复
热议问题