jQuery disable/enable submit button

jQuery disable/enable submit button


   $(function () {
        $('#btnSubmit').prop('disabled', true);
        $('#txtInput').keyup(function () {
            if ($(this).val() != '') {
                $('#btnSubmit').prop('disabled', false);
            }
        });
   });

                                 OR

   $(function () {
        $('#btnSubmit').sttr('disabled', disabled');
        $('#txtInput').keyup(function () {
            if ($(this).val() != '') {
                $('#btnSubmit').removeAttr ('disabled');
            }
        });
   });
           
                        OR

document.getElementById("btnSubmit").disabled = true;



Thank you!
ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

jQuery disable/enable submit button jQuery disable/enable submit button Reviewed by Anil Singh on 9:00 PM Rating: (5)
www.code-sample.com/. Powered by Blogger.
^