Function does not run ok in Safari

54 views Asked by At

I've got this jQuery, javascript, xui function that is running ok in Chrome and Firefox but it doesn't work as expected in Safari. What I'm trying to do is clear checkboxes in a group when one of them is check, just to have only one checkbox checked at the same time.

 <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;
            });
        }
   });
}

0

There are 0 answers