How do I disable/enable a form element?

jQuery

How do I disable/enable a form element?

You can enable or disable a form element using the .prop() method:

1
2
3
4
5
                          
// Disable #x
$("#x").prop( "disabled", true );
// Enable #x
$("#x").prop( "disabled", false );