I have some javascipt (jQuery) in which I'm fading in #myDiv when a button is clicked, and then fading it out again after 5 seconds by using a Timeout function. It works fine, but if a user clicks the button again before the fadeOut function inside my timeout runs, I need the timeout to stop and essentially start over again.

I'm thinking the answer will be to run a function first to clear the timeout, though I cannot make this work. 

```
$('button').on('click', function() {

  //need function here to stop the timeout if running

  $("#myDiv").fadeIn(slow);

  setTimeout(function(){
    $("#myDiv").fadeOut(slow);
  }, 5000);

});

```