The return value of setInterval
is an Id allowing you to cancel that interval:
var timer = setInterval(...);
// later on...
clearInterval(timer)
You need to store the setInterval Id in a variable, and then clear the interval on the next mouse click.