javascript - setTimout on loading animation after clicking submit -


i have animation funciton show 2 seconds once submit button clicked. not sure how put using settimeout function

$(window).ready(function () { "use strict"; var countdown = 2000; settimeout(function()){ var startanimation = function () {//this need animate 2 seconds     $(".normal-actions").hide();     $(".execute-actions").show();  };  $("form").attr("action", "url"); $(".btn-submit").on("click", function () {     $("form").submit; }); }); } 

current code (could not put in comments) page stays in loading , not redirect:

$(window).ready(function () {     "use strict";      var countdown = 2000;     settimeout(function(){         $(".normal-actions").hide();         $(".execute-actions").show();     }, countdown);      $("form").attr("action", "url");     $(".btn-submit").on("click", function () {         $("form").submit;     }); }); 

you never called settimeout , never made initial change ui. should call when submit clicked.

$(window).ready(function () {   "use strict";   var countdown = 2000;    var toggleanimation = function () {//this need animate 2 seconds       $(".normal-actions").toggle(); //toggles between show/hide       $(".execute-actions").toggle();   };    $("form").attr("action", "url");     $(".btn-submit").on("click", function () {       $("form").submit;       toggleanimation(); //first call start animation change ui       settimeout(toggleanimation, countdown); //then call startanimation again after 2 seconds change     });   }); } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -