我想知道是否有人知道如何自动推进 radio 输入?基本上检查一个 radio ,然后每隔一段时间检查下一个 radio ,等等。
这真的让我大吃一惊。这是我到目前为止所拥有的。
$("#image_box > :input:gt(0)").attr("checked",true);
setInterval(function() {
$("#image_box > :input:first")
.next()
.end()
.append().attr("checked",true);
}, 3000);
最佳答案
试试这个。每秒它都会检查下一个 radio 。
var $radios = $('input[type=radio]');
$radios.each(function(i, e) {
setTimeout(function(){
$(e).prop('checked', true);
}, 1000 * i);
});
关于JQuery - 自动推进 radio 输入 "checked",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12419455/