SO - 21312218
by Arun P Johny
HTML
<div class="wrap">
<input id="test-1" type="radio" name="testing" checked />
<input id="test-2" type="radio" name="testing" />
<input id="test-3" type="radio" name="testing" />
</div>
<button id="start-stop">Start/stop</button>
JavaScript
jQuery(function () {
var timer;
$("#start-stop").click(function () {
if (timer) {
clearInterval(timer);
timer = undefined;
} else {
timer = setInterval(function () {
$('.wrap input')
.eq(($('input:checked').index() + 1) % 3)
.prop('checked', true);
}, 1000);
}
});
})