Created
December 15, 2014 20:47
-
-
Save thomxc/603d47bd0e41b763a577 to your computer and use it in GitHub Desktop.
LimeSurvey Exclusivity workaround for multi dimensional multiple choice questions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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