我已经在Chrome和Firefox中运行了这个jQuery,javascript,xui函数,但它在Safari中并没有像预期的那样工作。 当我们检查其中一个复选框时,我尝试做的是清除组中的复选框,只是同时检查了一个复选框。
<script type="text/javascript">
<?php
foreach($qOptions as $qOption) { ?>
function fclearlistboxQ<?php echo $qOption->question_id . "_QO" . $qOption->id; ?>() {
<?php if($qOption->question->multiple == 0){ ?>
clearListBoxInputs("div#divQ<?php echo $qOption->question_id; ?>","Q<?php echo $qOption->question_id . "_QO" . $qOption->id; ?>");
<?php } ?>
}
x$("input#Q<?php echo $qOption->question_id . "_QO" . $qOption->id; ?>").click(fclearlistboxQ<?php echo $qOption->question_id . "_QO" . $qOption->id; ?>);
appendToTrigger('fclearlistboxQ<?php echo $qOption->question_id . "_QO" . $qOption->id; ?>');
<?php }?>
function clearListBoxInputs(divelement,selected) {
x$(divelement).find("input").each(function(element, index, xui) {
if(element.name != selected) {
x$(element).filter(function () {
return this.checked;
}).each(function (element, index, xui) {
element.checked = false;
});
}
});
}