Skip to content
Discussion options

You must be logged in to vote

For adding the interaction with the button you can use the following code:

    let button_rt, trial_start_time;
    
    var trial = {
        type: jsPsychSurveyHtmlForm,
        preamble: 'hello',
        html: function(){
            return '<div><button type="button" name="bottone" onclick="cambia()"><img id ="cuore" name = "cuore1" src="1.jpg" /></button> <input type="text" name="risposta"></input></div>'
        },
        button_label: 'Avanti',

        on_load : function(){
            button_rt = null;
            trial_start_time = performance.now();
        },
        on_finish : function(data){
            data.button_rt = button_rt;
        }
    }

    function cambia() {
 …

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@ChristopheBossens
Comment options

@aleargio
Comment options

@ChristopheBossens
Comment options

Answer selected by aleargio
@aleargio
Comment options

@ChristopheBossens
Comment options

@aleargio
Comment options

@ChristopheBossens
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