display_element ID selector does not work

79 views
Skip to first unread message

Md Abdullah Al Fahim

unread,
Jan 10, 2018, 5:30:46 PM1/10/18
to jsPsych

Hello,

I have started using jsPsych yesterday. I was trying to set jsPsych inside a div using

jsPsych.init({
      display_element: $('#myID'),
      ........
    });

It did not work. In the console I found:

SyntaxError: '#[object Object]' is not a valid selector

I handled the issue in jspsych.js replacing:
var display = document.querySelector('#' + opts.display_element);
with:
var display = document.querySelector('#' + opts.display_element[0].id);

I do not think it will work in the long. Please fix it. 

 










Dritan Nikolla

unread,
Jan 11, 2018, 1:14:26 PM1/11/18
to jsPsych
Hi Abdullah,

The best way to start is really by working with the tutorial found in the jspsych.org website. That would give you a good place to start.

Cheers,
Dritan

Josh de Leeuw

unread,
Jan 12, 2018, 9:46:41 AM1/12/18
to Dritan Nikolla, jsPsych
This looks like old syntax from jsPsych 4 or 5. Is the tutorial that you're using for version 6?
Cheers,
Josh

--
You received this message because you are subscribed to the Google Groups "jsPsych" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+u...@googlegroups.com.
To post to this group, send email to jsp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/404cb4ee-a0ae-4fb9-9eb8-4f8082884884%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Md Abdullah Al Fahim

unread,
Jan 12, 2018, 4:26:44 PM1/12/18
to Josh de Leeuw, Dritan Nikolla, jsPsych
I found the syntax from tests&examples folder from jspsych-5.0.3.

I could not find how to put the jsPsych contents in a div other than the body in jspsych-6 in the tutorials. Could you share the link to the tutorial where I could set the id?

Thanks.

To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+unsubscribe@googlegroups.com.

To post to this group, send email to jsp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/404cb4ee-a0ae-4fb9-9eb8-4f8082884884%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "jsPsych" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jspsych/qnRkLHtnhCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jspsych+unsubscribe@googlegroups.com.

To post to this group, send email to jsp...@googlegroups.com.

Josh de Leeuw

unread,
Jan 12, 2018, 4:32:32 PM1/12/18
to Md Abdullah Al Fahim, Dritan Nikolla, jsPsych
There's an example in the /examples folder of jsPsych 6 that shows how to use it:

Cheers,
Josh

To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+u...@googlegroups.com.

To post to this group, send email to jsp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/404cb4ee-a0ae-4fb9-9eb8-4f8082884884%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "jsPsych" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jspsych/qnRkLHtnhCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jspsych+u...@googlegroups.com.

Md Abdullah Al Fahim

unread,
Jan 12, 2018, 4:33:39 PM1/12/18
to Josh de Leeuw, Dritan Nikolla, jsPsych
Thank you!

To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+unsubscribe@googlegroups.com.

To post to this group, send email to jsp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/404cb4ee-a0ae-4fb9-9eb8-4f8082884884%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "jsPsych" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jspsych/qnRkLHtnhCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jspsych+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages