xxxxxxxxxx
<button type="button" disabled>This button is disabled</button>
xxxxxxxxxx
<button type="button" disabled={condition? condition_true : condition_false}>Disabled with ternary</button>
ex: disabled={coin > 0 ? buy_a_car() : "No money"}
xxxxxxxxxx
const textDisabled = text.length === 0 || text.trim().length === 0
xxxxxxxxxx
collector.on('collect', async i => {
if (i.customId === 'id_1') {
row.components[0].setDisabled(true) //disables but_1
}
if (i.customId === 'id_2') {
row.components[1].setDisabled(true) //disables but_2
}
interaction.editReply({ content: "Click a button", components: [row] });
})
xxxxxxxxxx
let button = document.getElementById("btn");
button.setAttribute("disabled","true");
button.style.pointerEvents = "none";
button.style.opacity = 0.5;