PennController for IBEX › Forums › Support › Logging randomly generated IDs for MTurkers › Reply To: Logging randomly generated IDs for MTurkers
February 3, 2023 at 9:29 am
#9879
Jeremy
Keymaster
Hi Jun,
What version of PennController are you using? Also, what does your HTML file look like?
Using PennController 2.0 and this HTML code, things work just fine for me:
<script> function newCode() { const randomCode = [...Array(8)].map(()=>Math.round(Math.random()*10)).join(''); document.querySelector("#code").value = randomCode; document.querySelector("#codeDisplay").innerText = randomCode; } </script> <button onclick="newCode()">Generate code</button> <input id='code' type='text' name='code' style='display:none;' class='obligatory' /> <p>Your code is <span id='codeDisplay'></span></p>
Jeremy