Hi Jeremy!
I’m trying to disable a particular key in the Text Input element. Here you gave me a javascript function, but I haven’t been able to implement it in my script (https://farm.pcibex.net/r/QfspMA/). I’ve tried stating the function at the beginning of the script and then using the .call() command in the NewTrial or creating and executing the function inside the trial, but none seem to work.
I leave the javascript function here:
newTextInput("myInput", "").print()
,
newFunction(()=>setTimeout(()=>document.querySelector("textarea.PennController-myInput").addEventListener("keydown",e=>{
if (!e.key.match(/s/i)) return true;
e.preventDefault();
e.stopPropagation();
return false;
}),200)).call()
Thanks in advance!
M.