Hi there. I have browsed and tried many options from other forum posts. For some reason the Java script I am using in one of my multiple choice questions is not working to uncheck all the other multiple choice options if the last option is checked (i.e. Don't know). But it works for other questions where I have used it. I am thinking that the problem is that that question depends heavily on other questions (piping and conditionals). I am not a JavaScript savvy person nor a LimeSurvey expert, everything I did on my survey I got it from other forum posts (so I basically copy-paste any Javascript code, but do not understand it. However, I now understand more the code used in LS, and can do it on my own). I am attaching two screenshots, one is the question that would lead you to the question that is not working. I am also attaching the question structure so you can see my code.
I am using this javascript:
<script type='text/javascript'>
// Set check or unchecked all checkboxes
function checkAll(e) {
var checkboxes = document.getElementsByName('check');
if (e.checked) {
for (var i = 0; i < checkboxes.length; i++) {
checkboxes
.checked = true;
}
} else {
for (var i = 0; i < checkboxes.length; i++) {
checkboxes.checked = false;
}
}
}
// Hide Checked rows
function hideChecked(){
var checkboxes = document.getElementsByName('check');
for (var i = 0; i < checkboxes.length; i++) {
var checkid = checkboxes.id;
var split_id = checkid.split("_");
var rowno = split_id[1];
if(checkboxes.checked){
document.getElementById("tr_"+rowno).style.display="none";
}
}
}
// Reset layout
function reset(){
var checkboxes = document.getElementsByName('check');
document.getElementsByName("showhide")[0].checked=false;
for (var i = 0; i < checkboxes.length; i++) {
var checkid = checkboxes.id;
var split_id = checkid.split("_");
var rowno = split_id[1];
document.getElementById("tr_"+rowno).style.display="table-row";
checkboxes.checked = false;
}
}
</script>
Please let me know if you need anything else. I don't think I would be able to upload the whole survey though
Thank you so much for any help you can give me
!!