jquery enabling a button after some time -


this code not working , disables code , after must enable , how it? wrong? doing avoid multiple clicks

<% html.enableclientvalidation(); %>     $(document).ready(function () {         $('#form1').submit(function () {             $('#btn').attr("disabled", "disabled");             settimeout('enablebutton()', 50);         });         function enablebutton() {             $('#btn').removeattr('disabled');         }     });   <% using (html.beginform("create","organizationgroups",formmethod.post,new {id="form1"}))  {%> %> <%= html.validationsummary(false)%>   <div>     <%= html.actionlink("back list", "manageorganizationgroup")%> </div> 

you can't pass string settimeout() here, since function isn't global, instead pass direct reference function, change this:

settimeout('enablebutton()', 50); 

to this:

settimeout(enablebutton, 50); 

in general always try this, it'll avoid many issues...like 1 you're having.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -