Skip to content

Ending trial when specific button is selected #3278

Discussion options

You must be logged in to vote

You could just make response and rt global variables (i.e., by declaring from outside of on_load). Then, if the trial ends without "skip" being clicked, just append the data in on_finish.

let response, rt;
var video_trial = {
    type: jsPsychHtmlButtonResponse,
    stimulus: stimulus: function(){
        var html = 
            '<video autoplay controls muted src="'+jsPsych.timelineVariable('videos')+'"></video>' +
            '<img src="images/image1.png"</img>';
        return html;
    },
    choices: ['Like', 'Skip'],
    button_html: ['<button class="jspsych-btn">%choice%</button>', '<button class="jspsych-btn">%choice%</button>'],
    response_ends_trial: false /*making this false …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@steventmartinez
Comment options

@Shaobin-Jiang
Comment options

@steventmartinez
Comment options

@Shaobin-Jiang
Comment options

Answer selected by jodeleeuw
@steventmartinez
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