There are three input type="radio" , it is necessary that they switch in turn after a certain time (3-5 seconds) in a circle.

  <div class="slider"> <input type="radio" name="fruit" value="orange" id="orange" checked="checked"> <input type="radio" name="fruit" value="apple" id="apple"> <input type="radio" name="fruit" value="banana" id="banana"> <label for="apple">apple</label> <label for="orange">orange</label> <label for="banana">banana</label> </div> 
  • Do you need advice or a person who writes everything for you? If the first, then use setInterval (function () {}, 3000), if the second, then you are wrong site. - Fomina Catherine

1 answer 1

Elementary https://jsfiddle.net/w2svuf1c/

 $inputs = $('input'); setInterval(function(){ $next = $inputs.filter(":checked").next('input'); if ($next.length) $next.prop('checked', true); else $inputs.first().prop('checked', true); }, 3000); 
 <div> <input type="radio" name="fruit" value="orange" id="orange" checked="checked"> <input type="radio" name="fruit" value="apple" id="apple"> <input type="radio" name="fruit" value="banana" id="banana"> <label for="apple">apple</label> <label for="orange">orange</label> <label for="banana">banana</label> </div> 

  • And how to do that would apply only to the div class = "slider"? - Denis Korytkin
  • @DenisKorytkin $inputs = $('.slider').find('input'); - SlyDeath
  • Thank! Everything works as I wanted - Denis Korytkin