Skip to content

create a survey-multi-choice trial but with free entry "other" option? #3229

Answered by Shaobin-Jiang
HenningTm asked this question in Q&A
Discussion options

You must be logged in to vote

An example piece of code. Please read the comments as it explains the code in details.

let trial = {
    type: jsPsychSurveyMultiChoice,
    questions: [
        {
            prompt: 'Which would you prefer?',
            options: ['foo', 'bar', 'other']
        }
    ],
    on_load: function () {
        // Create an invisible text input after the "other" option
        let input = document.createElement('input');
        input.placeholder = 'enter your preference';
        input.style.display = 'none';

        // Insert the element after the "other" option
        //
        // Note, however, that the radio element and the text description are two elements. As the description, i.e.,

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by HenningTm
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Shaobin-Jiang
Comment options

@HenningTm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants