Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda