Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Hiding div block in html when loading amazon mechanical turn template

I want to submit work to Amazon Mechanical Turk to help me annotating some data.

I have a research ethics consent that I need to show to the workers at the beginning before they start their jobs.

My csv file looks like:

variable2,consent
,This is the consent
text1,
text2,
text3,

HTML code:

<!-- You must include this JavaScript file -->
<script src="https://assets.crowd.aws/crowd-html-elements.js"></script>

<script type="text/javascript">
function show_hide_data() {
    var co = new String(${consent});
    if(co.length > 2){
        document.getElementById('con_').style.display ='block';
        document.getElementById('data_').style.display ='none';
    } else{
        document.getElementById('con_').style.display ='none';
        document.getElementById('data_').style.display ='block';
    }
}
</script>

<body onload="javascript:show_hide_data()">
<!-- You must include crowd-form so that your task submits answers to MTurk -->
<crowd-form answer-format="flatten-objects">
    
<div id="con_">
    <p> Consent: ${consent}</p>
</div>

<div id="data_">
     <p> Text: ${variable2}</p>
</div>

</crowd-form>
</body>

My idea is, using javascript, I want to show the con_ div and hide data_ div when there is a consent text in the csv (first line), and vice versa.

The code works well locally, but it seems that the javascript part doesn't when I test it on the website.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!