我有这个 jQuery、javascript、xui 函数,它在 Chrome 和 Firefox 中运行正常,但在 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;
});
}
});
}