- Posts: 7
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<p>ok</p> <p>This is a question with lots of text</p> <p><strong>This is a question with lots of text</strong></p> ...
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Insert selects into row 1 if($('tr.subquestion-list:eq(0) .answer-item .inserted-select', thisQuestion).length == 0) { $('tr.subquestion-list:eq(0) .answer-item', thisQuestion).on('mousedown', function(){ var htmlstuff = document.getElementsByClassName("question-text"); $( this).val( htmlstuff.outerHTML); } // Clean-up styles $('select.inserted-select', thisQuestion).css({ 'max-width': '100%' }); $('.with-select input:text', thisQuestion).css({ 'position': 'absolute', 'left': '-9999em' }); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
var htmlstuff = document.getElementsByClassName("question-text") htmlstuff.outerHTML
if($('tr.subquestion-list:eq(0) .answer-item .inserted-select', thisQuestion).length == 0) { $('tr.subquestion-list:eq(0) .answer-item', thisQuestion)
$( this).val()
Please Log in to join the conversation.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); $('input:text.form-control:first', thisQuestion).val($.trim($('.ls-label-question', thisQuestion).html())); }); </script>
Please Log in to join the conversation.
As Joffm, I have no idea why you would want to load HTML that you already know into a text input.
Please Log in to join the conversation.
<script type="text/javascript"> $(document).on('mouseup',function(){ var thisQuestion = $('#question{QID}'); $('input:text.form-control:first', thisQuestion).val($.trim($('.ls-label-question', thisQuestion).html())); }); </script><script type="text/javascript" charset="utf-8"> document.onmousedown = () => { sel = window.getSelection(); if (sel.rangeCount && sel.getRangeAt) { range = sel.getRangeAt(0); } // Set design mode to on document.designMode = "on"; if (range) { sel.removeAllRanges(); sel.addRange(range); } // Colorize text document.execCommand("BackColor", false, "#FF0011"); // Set design mode to off document.designMode = "off"; } </script>
Please Log in to join the conversation.
Can 'input:text.form-control:first' be modified to specify the first unpopulated text box?
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // Define this question var thisQuestion = $('#question{QID}'); // Find the first empty input var firstEmptyInput = $('input:text.form-control', thisQuestion).filter(function() { return $.trim($(this).val()) == ''; })[0]; // Now, load that input $(firstEmptyInput).val($.trim($('.ls-label-question', thisQuestion).html())); }); </script>
Please Log in to join the conversation.