Countdown on PLACEHOLDER is it possible?

2

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?

    
asked by anonymous 06.02.2016 / 00:55

1 answer

0

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>
    
06.02.2016 / 01:40