0

Qualtrics used to have a section of their website called Coder's Corner that had snippets of code that could be used to advance the functionality of the surveys but they did away with that section.

I am looking for the Javascript code that controls the size of a question text box, specifically a constant sum text box. I would greatly appreciate any help I can get. Thanks

Nate
  • 12,963
  • 4
  • 59
  • 80
Shannon
  • 1
  • 1
  • 1

2 Answers2

3

The answers given don't specifically apply to a Qualtrics constant sum question. I think the code below is what you are looking for. Change "75px" to the desired width.

Qualtrics.SurveyEngine.addOnload(function()
{
    var inputWidth = "75px";
    $(this.questionId).select('.SumInput').each(function(name, index) {
        name.style.width = inputWidth;
    });
    $(this.questionId).select('.SumTotal').each(function(name, index) {
        name.style.width = inputWidth;
    }); 
    $(this.questionId).select('.InputText').each(function(name, index) {
        name.style.width = inputWidth;
    });
});

I don't believe the specific code above was ever included on the Qualtrics javascript page. I've made a number of Qualtrics javascripts publicly available at https://gist.github.com/marketinview/

T. Gibbons
  • 4,919
  • 2
  • 15
  • 32
0

This code should do what you are looking to do:

function makeBigger(){ 
var txt = document.getelementbyid('txtbox');
txt.style['width'] = '100px';
 }

Click here for more info

Andy K
  • 4,944
  • 10
  • 53
  • 82