Skip to content

Instantly share code, notes, and snippets.

@thomxc
Created December 15, 2014 20:47
Show Gist options
  • Save thomxc/603d47bd0e41b763a577 to your computer and use it in GitHub Desktop.
Save thomxc/603d47bd0e41b763a577 to your computer and use it in GitHub Desktop.
LimeSurvey Exclusivity workaround for multi dimensional multiple choice questions
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var arrExclusive = ["A5", "A6"];
for (index = 0; index < arrExclusive.length; index++) {
$('input[type="checkbox"][name$="'+arrExclusive[index]+'"]').change(function(event) {
var objClicked = this;
var clicked = $(this).attr('name').substr(0,$(this).attr('name').length-2);
$('input[type="checkbox"][name^="'+clicked+'"]').each(function() {
if (this != objClicked) {
$(this).attr("disabled", !$(this).attr("disabled"));
$(this).attr('checked',false);
}
})
});
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment