$("input").prop('disabled', true);
$("input").prop('disabled', false);

This will automatically add/remove the ‘disabled’ property of the element.

Source: http://stackoverflow.com/a/1414366/4669143