javascript - replace button with other button -
i have 2 button
elements. on click of first button, second button appears , first 1 disappears. @fiddle
$(document).ready(function () { $("#startclock").click(function () { $("#startclock").fadeout().delay(120000).fadein(); $("#submitamt").fadein().delay(120000).fadeout(); }); });
<button class="rightbtn" type="button" id="startclock">start</button> <button class="rightbtn" type="button" id="submitamt" style="display:none;">submit</button>
everything fine when second button replaces first 1 slides right left. want second button should replace first 1 directly on it, without sliding/taking space/without affecting css
can tell how so?
try this, might help
you need use callbacks
$(document).ready(function () { $("#startclock").click(function () { $("#startclock").fadeout(function(){ $("#submitamt").fadein().delay(120000).fadeout(function(){ $("#startclock").delay(120000).fadein(); }); }) }); });
or simply
$(document).ready(function () { $("#startclock").click(function () { $("#startclock").fadeout(function(){ $("#submitamt").fadein().delay(120000).fadeout(function(){ $("#startclock").fadein(); }); }) }); });
in case once delay 120000 milisecs.
Comments
Post a Comment