Javascript to change the size of qualtrics text box

帅比萌擦擦* 提交于 2019-12-12 04:11:12

问题


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


回答1:


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/




回答2:


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



来源:https://stackoverflow.com/questions/36649711/javascript-to-change-the-size-of-qualtrics-text-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!