submit disabled fields

后端 未结 8 1591
无人及你
无人及你 2020-12-03 04:34

I know the defined behavior for web forms is to not submit disabled fields... but that\'s not the definition I want. I want to use ajax to post the form and I want it to ge

8条回答
  •  眼角桃花
    2020-12-03 05:03

    You can also just re-enable the fields before submission using the following:

    $('#form').submit(function() {
        $('[disabled]').each(function(i) {
            var d_name = $(this).attr("name");
            var d_val = $(this).val();
            $(this).attr("disabled", false);
        });
        return true;
    });
    
    $('#form').submit();
    

提交回复
热议问题