jquery if no change made to the input field after 10 seconds, show this Div -
i have button changes form on click. how change after 10 seconds if nothing inputted (if form still empty)?
update:
$(document).ready(function(){ $("#btn").click(function (){ $.ajax({ success: function(html){ if(html){ $('#btn').replacewith('<input class="offer_pay_form" type="text"><input type="submit" value="submit"></span>'); } } }); });
use this
settimeout(function(){ if($("input").val()=="") { alert("you havent input yet"); }},10000);
instead of replacing. try way
<input type="button" id="btn" /> <div id="container"></div>
script
$(document).ready(function () { $("#btn").click(function () { $.ajax({ success: function (html) { if (html) { $(this).hide(); $('body').append('<div id="newdata"><input class="offer_pay_form" type="text"><input type="submit" value="submit"></span></div>'); settimeout(function () { if ($(".offer_pay_form").val() == "") { $("#newdata").hide(); $("#btn").show(); } }, 10000); } } }); }); });
Comments
Post a Comment