Note that there are some explanatory texts on larger screens.

plurals
  1. POEnable and disable button using javascript and asp.net
    text
    copied!<p>I am checking if user exists in database if exists I am showing message as "existed user" and then I need to disable the signup button if not I need to enable it.</p> <p>I am unable to enable and disable the sign Up button.</p> <p>Can anyone help me in this issue?</p> <p>Here is my code:</p> <pre><code> &lt;script type="text/javascript"&gt; $(function () { $("#&lt;% =btnavailable.ClientID %&gt;").click(function () { if ($("#&lt;% =txtUserName.ClientID %&gt;").val() == "") { $("#&lt;% =txtUserName.ClientID %&gt;").removeClass().addClass('notavailablecss').text('Required field cannot be blank').fadeIn("slow"); } else { $("#&lt;% =txtUserName.ClientID %&gt;").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow"); $.post("LoginHandler.ashx", { uname: $("#&lt;% =txtUserName.ClientID %&gt;").val() }, function (result) { if (result == "1") { $("#&lt;% =txtUserName.ClientID %&gt;").addClass('notavailablecss').fadeTo(900, 1); document.getElementById(#&lt;% =btnSignUp.ClientID %&gt;').enabled = false; } else if (result == "0") { $("#&lt;% =txtUserName.ClientID %&gt;").addClass('availablecss').fadeTo(900, 1); document.getElementById('#&lt;% =btnSignUp.ClientID %&gt;').enabled = true; } else { $("#&lt;% =txtUserName.ClientID %&gt;").addClass('notavailablecss').fadeTo(900, 1); } }); } }); $("#&lt;% =btnavailable.ClientID %&gt;").ajaxError(function (event, request, settings, error) { alert("Error requesting page " + settings.url + " Error:" + error); }); }); &lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload