'django - disable button in javascript based on text input

I've got problem to disable submit button conditionally. My js code is as follows:

function disableButton() {
        var btnSubmit = document.getElementById('sub_butt');
        if (document.getElementsByName('submitted').value == "yes") {
            btnSubmit.disabled = true;
        }
        else {
            btnSubmit.disabled = false;
        }
    }

In django I have updateForm with formset and I would like to disable button based on value text field with name "submitted". I've tried the code above but nothing's changed. Field "submitted" is already filled out with value 'yes'



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source