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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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