Pass "disabled" as Use the setAttribute() method to set the disabled attribute. Discuss. The absence of the attribute means its value is false. JS WORLD var from = jQuery('select[name=select_from]'); Disabled buttons using the element behave a bit different: s don't support the disabled attribute, so you must add the .disabled class to make it visually appear disabled. Use id if you want to Add a disabled attribute on a single element. To disable a button in TypeScript: Select the button element. We used the getElementById () method to select the button.