I would like to know first if this is possible, and also disable the input where the placeholder is until the countdown ends and when the countdown finishes enabling again? some sketch? jquery and the right one?
I would like to know first if this is possible, and also disable the input where the placeholder is until the countdown ends and when the countdown finishes enabling again? some sketch? jquery and the right one?
With jQuery it's very easy, here's an example below:
$("#btnClick").click(function(){
var cont = 10;
var interval = setInterval(function(){
cont--;
$("#myInput").attr("disabled", true );
$("#myInput").attr("placeholder", cont );
if(cont == 0){
$("#myInput").attr("disabled", false );
clearInterval(interval);
}
},1000);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script><inputtype="text" id="myInput" placeholder="10" />
<button id="btnClick">Go Contagem!</button>