I have an input field which is disabled or not based on its contents. However I also have a button which changes the value of this field using the javascript
getElementById('field_name').value = "something".
Is it possible to have it so that this will not change the value of the field if it is disabled?
I have tried both setting the field to readonly and disabled, but this doesn’t stop the button from changing its value
The simplest way is probably to perform the check in your button’s
clickhandler.Instead of doing:
Do: