Edit in JSFiddle

var count,openTime, counter;
function openTimer()
{
    clearTimeout(openTime);
    clearInterval(counter);
    count=6;
    document.getElementById("timer").innerHTML='';           
    openTime=setTimeout(startTimer(),3000);
}
function startTimer()
{
    counter=setInterval(timer, 1000);
}

function timer()
{
  count=count-1;
  if (count <= 0)
  {
      document.getElementById("timer").innerHTML='Data Saved';
     clearInterval(counter);
      
     // execute save function
     return;
  }
  document.getElementById("timer").innerHTML='Saving in '+count; 
    
}
<a href='http://z54.com'>Example of how to create a countdown to saving edited data</a><br>
<input onkeyup='openTimer()' type='text' /><span id='timer'></span>