Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Defining each column width in Array (Text) questions

More
5 years 4 months ago #197147 by Joffm
Oh, I saw that the "old", original post was about:

I am using limesurvey 2.50, I want to have different input box width for each multiple short text subquestions.

Alzheimer or the glasses get worse.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
5 years 4 months ago - 5 years 4 months ago #197148 by tpartner

Alzheimer or the glasses get worse.

I have both. :)

With Javascript:

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).on('ready pjax:complete',function() {
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // First column
    $('td.answer-item:nth-child(2) input:text', thisQuestion).attr('size', 4);
    // Second column
    $('td.answer-item:nth-child(3) input:text', thisQuestion).attr('size', 20);
  });
</script>

With CSS:

Code:
<style type="text/css">
 
  /* First column */
  #question{QID} td.answer-item:nth-child(2) input[type="text"] {
    width: 50px;
  }
 
  /* Second column */
  #question{QID} td.answer-item:nth-child(3) input[type="text"] {
    width: 150px;
  }
</style>


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 4 months ago by tpartner.
The topic has been locked.
More
5 years 4 months ago #197150 by Vinicos
The column widths!
The topic has been locked.
More
5 years 4 months ago #197159 by Vinicos
It works well now!
Thanks very much!
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose