This doesn't measure reaction time, but it's a working example of setInterval
/ clearInterval
.
updateText = function(){
$("body").append( $("<p></p>").html(Date()))
}
timer = setInterval( updateText, 2000 )
$(document).keypress(function(){
clearInterval( timer)
$("body").append( $("<p></p>").html("Keypress at " + Date() ))
timer = setInterval( updateText, 2000 )
})