Hi! Just tried to run your code and got it to work fine The only problems were:
- The
"javascript"
currently can't be overwritten by the block, so you have to add it in the"config"
. So basically, it didn't run before, which is why nothing happened. (Also make sure you don't have any"javascript"
value in yourprodigy.json
btw, otherwise you'd override the recipe config.) - There's no need to run
document.querySelector('#is_wcl_checkbox').checked = false
at the beginning here – this would only run once anyways, before Prodigy is mounted, and result in an error (because the checkbox isn't there yet). If you want to make sure that the checkbox is rerendered every time a new task comes in, the easiest way is to add an HTML attribute that changes for every task – e.g. by adding a property likekey
that's populated by a variable unique to the task. For example,key="{{_task_hash}}"
uses the task hash, which we know is always unique.
HTML_TEMPLATE = '<input key="{{_task_hash}}" type="checkbox" id="is_wcl_checkbox" /><label for="is_wcl_checkbox">Is bias by word choice and labeling regading highlighted subject (how it is described, not what)?</label>'