- Posts: 29
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
<tbody> <tr id="javatbd749145X8X40SQ001" class="well answers-list radio-list array2"> <th class="answertext"> Question 1 <input id="java749145X8X40SQ001" type="hidden" value="" name="java749145X8X40SQ001"> </th> <td class="answer-cell-3 answer_cell_A1 answer-item radio-item text-center radio" data-title="I"> <input id="answer749145X8X40SQ001-A1" class="radio" type="radio" aria-labelledby="label-answer749145X8X40SQ001-A1" onclick="checkconditions(this.value, this.name, this.type)" value="A1" name="749145X8X40SQ001"> <label for="answer749145X8X40SQ001-A1"></label> <div id="label-answer749145X8X40SQ001-A1" class="hide label-text"> I </div> </td>
<?php /** * Array, no drop down * @var $label * @var $ld * @var $myfname * @var $ld * @var $CHECKED * @var $checkconditionFunction */ ?> <!-- answer_td --> <td data-bs-title='<?php echo $label;?>' class="answer-cell-3 answer_cell_<?php echo $ld;?> answer-item radio-item text-center radio"> <input class="radio" type="radio" name="<?php echo $myfname;?>" value="<?php echo $ld; ?>" id="answer<?php echo $myfname;?>-<?php echo $ld; ?>" <?php echo $CHECKED; ?> onclick="<?php echo $checkconditionFunction; ?>(this.value, this.name, this.type)" aria-labelledby="label-answer<?php echo $myfname;?>-<?php echo $ld; ?>" /> <label for="answer<?php echo $myfname;?>-<?php echo $ld; ?>" ><span class="show-mobile"><?php echo $label;?></span></label> <!-- The label text is provided inside a div, so final user can add paragraph, div, or whatever he wants in the subquestion text This field is related to the input thanks to attribute aria-labelledby --> <?php /* <div class="label-text" id="label-answer<?php echo $myfname;?>-<?php echo $ld; ?>"> <?php echo $label;?> </div> */ ?> </td> <!-- end of answer_td -->
var windowWidth = 0; function showHideMobileDesktop(onload) { // Run when page loaded if(onload == 1) { if(windowWidth > 820) { jQuery('.show-desktop').show(); jQuery('.show-mobile').hide(); } else { jQuery('.show-desktop').hide(); jQuery('.show-mobile').show(); } } // Switch from desktop to mobile if (windowWidth > 802 && jQuery(window).width() < 802) { jQuery('.show-desktop').hide(); jQuery('.show-mobile').show(); } // Switch from mobile to desktop if (windowWidth < 802 && jQuery(window).width() > 802) { jQuery('.show-desktop').show(); jQuery('.show-mobile').hide(); } }
$(document).ready(function() { windowWidth = jQuery(window).width(); showHideMobileDesktop(1); }); $(window).resize(function() { showHideMobileDesktop(0); windowWidth = jQuery(window).width(); });
<?php /** * Array, no drop down * @var $label * @var $ld * @var $myfname * @var $ld * @var $CHECKED * @var $checkconditionFunction */ ?> <!-- answer_td --> <td data-bs-title='<?php echo $label;?>' class="answer-cell-3 answer_cell_<?php echo $ld;?> answer-item radio-item text-center radio"> <input class="radio" type="radio" name="<?php echo $myfname;?>" value="<?php echo $ld; ?>" id="answer<?php echo $myfname;?>-<?php echo $ld; ?>" <?php echo $CHECKED; ?> onclick="<?php echo $checkconditionFunction; ?>(this.value, this.name, this.type)" aria-labelledby="label-answer<?php echo $myfname;?>-<?php echo $ld; ?>" /> <label for="answer<?php echo $myfname;?>-<?php echo $ld; ?>" ></label> <!-- The label text is provided inside a div, so final user can add paragraph, div, or whatever he wants in the subquestion text This field is related to the input thanks to attribute aria-labelledby --> <div class="label-text" id="label-answer<?php echo $myfname;?>-<?php echo $ld; ?>"> <?php echo $label;?> </div> </td> <!-- end of answer_td -->
var windowWidth = 0; $(document).ready(function() { windowWidth = jQuery(window).width(); showHideMobileDesktop(1); }); $(window).resize(function() { showHideMobileDesktop(0); windowWidth = jQuery(window).width(); }); function showHideMobileDesktop(onload) { // Run when page loaded if(onload == 1) { if(windowWidth > 820) { jQuery('.answer-item .label-text').show(); jQuery('.answer-item .label-text').hide(); } else { jQuery('.answer-item .label-text').hide(); jQuery('.answer-item .label-text').show(); } } // Switch from desktop to mobile if (windowWidth > 802 && jQuery(window).width() < 802) { jQuery('.answer-item .label-text').hide(); jQuery('.answer-item .label-text').show(); } // Switch from mobile to desktop if (windowWidth < 802 && jQuery(window).width() > 802) { jQuery('.answer-item .label-text').show(); jQuery('.answer-item .label-text').hide(); } }
I really hate this javascript system to show or not the text.holch wrote: Maybe you can search for the bug report regarding this (i think it hasn't been solved yet) and add your solution or a link to this post. Maybe it helps the developers to solve the problem quicker.
<?php /** * Array, no drop down * @var $label * @var $ld * @var $myfname * @var $ld * @var $CHECKED * @var $checkconditionFunction */ ?> <!-- answer_td --> <td data-bs-title='<?php echo $label;?>' class="answer-cell-3 answer_cell_<?php echo $ld;?> answer-item radio-item text-center radio"> <input class="radio" type="radio" name="<?php echo $myfname;?>" value="<?php echo $ld; ?>" id="answer<?php echo $myfname;?>-<?php echo $ld; ?>" <?php echo $CHECKED; ?> onclick="<?php echo $checkconditionFunction; ?>(this.value, this.name, this.type)" aria-labelledby="label-answer<?php echo $myfname;?>-<?php echo $ld; ?>" /> <label for="answer<?php echo $myfname;?>-<?php echo $ld; ?>" ></label> <!-- The label text is provided inside a div, so final user can add paragraph, div, or whatever he wants in the subquestion text This field is related to the input thanks to attribute aria-labelledby --> <div class="label-text visible-mobile" id="label-answer<?php echo $myfname;?>-<?php echo $ld; ?>"> <?php echo $label;?> </div> </td> <!-- end of answer_td -->
.visible-mobile { display: inline; } .visible-desktop { display: none; } @media (min-width: 802px) { .visible-mobile { display: none; } .visible-desktop { display: inline; } }