Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable all disabled input and select element

I want to Enable all disabled input and select elements before submiting the form so i can get all disabled elements values.

So i tried

function enable() {

        $('input[type="text"], input[type="checkbox"], select').prop("disabled", true).each(function () {

            if ($(this).is(':disabled')) {
                $(this).attr('disabled', false);
            }

        });
    }

This code is not working so could you please help me to this job.

Thanks in Advance....

like image 586
Zero Cool Avatar asked Jul 01 '26 03:07

Zero Cool


1 Answers

You can try

function enable() {
    $('input:disabled, select:disabled').each(function () {
       $(this).removeAttr('disabled');
    });
}

http://api.jquery.com/disabled-selector/

like image 91
Bruno Bernardo Mascarenhas Avatar answered Jul 02 '26 18:07

Bruno Bernardo Mascarenhas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!