Unfortunately, still not change :(
Maybe a little more information helps? NU07 is the text I created, which should appear once any button is clicked. The "Darstellung" selected is "Einfacher Text". Is this correct? I also realized the element ID is NU07_media, not NU07_text. But still no change...
All seven options stand for all seven available buttons. There are no other buttons, so providing any answer at all should trigger the dropdown.
This is the new code:
<script type="text/javascript">
<!--
var optionA = document.getElementById("NU06_011"); // NU06_011 is the HTML ID of the selection option "Very unlikely"
var optionB = document.getElementById("NU06_012"); // "Slightly unlikely" option
var optionC = document.getElementById("NU06_013"); // "Unlikely" option
var optionD = document.getElementById("NU06_014"); // "Neutral" option
var optionE = document.getElementById("NU06_015"); // "Likely" option
var optionF = document.getElementById("NU06_016"); // "Slightly likely" option
var optionG = document.getElementById("NU06_017"); // "Likely" option
var text = document.getElementById("NU07_media"); // HTML ID of the text input
function toogle() {
// the two pipes (||) are a logicial "or"
// the condition checks: is option A selected or is B selected?
if (optionA.checked || optionB.checked || optionC.checked || optionD.checked || optionE.checked || optionF.checked || optionG.checked) {
// if any button is clicked, then the question is shown
// no input ("") uses the default setting (display as usual)
text.style.display = "";
} else {
// question is hidden if the "none" option is selected
text.style.display = "none";
}
}
// The function should always be executed, if one of the buttons is clicked on
SoSciTools.attachEvent(optionA, "click", toogle);
SoSciTools.attachEvent(optionB, "click", toogle);
SoSciTools.attachEvent(optionC, "click", toogle);
SoSciTools.attachEvent(optionD, "click", toogle);
SoSciTools.attachEvent(optionE, "click", toogle);
SoSciTools.attachEvent(optionF, "click", toogle);
SoSciTools.attachEvent(optionG, "click", toogle);
// and the function should also be executed, so that the display at the beginning is correct
// (e.g. hide the text input at the beginning)
toogle();
// -->
</script>
This is what the error console is saying:
Uncaught TypeError: Cannot read property ?act=SczFRN3hnzyCl51b2LBzvLeF:639
'style' of null
at toogle (?act=SczFRN3hnzyCl51b2LBzvLeF:639)
at ?act=SczFRN3hnzyCl51b2LBzvLeF:654