We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is there a way to disable the button after click on it.


I need to disable a button after clicking on it and if a condition true then need to enable it again. Is there any way to do this?

Thank you,


3 Replies

YA YuvanShankar Arunagiri Syncfusion Team October 31, 2022 07:07 AM

Hi Kalum,

We have checked your reported query and prepared the sample based on your requirement. Please refer the below code snippet. Using the disabled property of button, we can change it dynamically based on condition.


<br />




    document.getElementById("btn").addEventListener('click', function () {

        var Btn = document.getElementById("btn").ej2_instances[0];

        Btn.disabled = true;


    function onChange(args) {

        if (args.checked) {

            var Btn = document.getElementById("btn").ej2_instances[0];

            Btn.disabled = false;




Could you please check the above code and get back to us, if you need any further assistance on this.


YuvanShankar A

KA kalum replied to YuvanShankar Arunagiri November 4, 2022 12:55 AM

hi Yuvan,

It works fine. Thank you very much for your help.



NA Nivetha Anandan Syncfusion Team November 7, 2022 09:13 AM

You’re welcome, Kalum.

If that post is helpful, please mark it as an answer so that other members can locate it more quickly.

Live Chat Icon For mobile
Up arrow icon