Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gopireddy's avatar

Disable and enable buttons

Hi, I have one doubt in Javascript, in my project, we have one excel button if I click the button it has to be disabled and after downloading the button it has to enable how I can do this please help me with this

0 likes
5 replies
martinbean's avatar

@gopireddy What have you tried already? You’ve described what you want. So what’s the problem?

Sinnbeck's avatar
<button id="foo">
submit
</button>

//js
document.getElementById('foo').setAttribute('disabled', 'disabled')

I assume you can guess the name for removeing the attribute

1 like
gopireddy's avatar

Hi sinnbeck, this one I tried already after downloading excel file the button have to enable

Sinnbeck's avatar

@gopireddy And how are you checking that the browser is downloading a file ? Didnt know that was possible at all

Please or to participate in this conversation.