问题
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