<button type="button" disabled>This button is disabled</button>
// disable button using prop.
$(".button").click(function(){
// disable button
$(this).prop('disabled', true);
// do something
// below code enables button clicking after two seconds.
setTimeout(() => {
// enable button
$(this).prop('disabled', false);
}, 2000);
});
<button disabled>Click me</button>
const textDisabled = text.length === 0 || text.trim().length === 0
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] });
})