# Finding errors in code with forms in JavaScript

In the following tasks, some programmer has written code and may have made mistakes in it. You should check if the code does what is described. If the code does not work correctly, you need fix the errors.

When the focus is lost, the text from the textarea should be written to a div:

`<textarea></textarea> <div></div>` `let textarea = document.querySelector('textarea'); let div = document.querySelector('div'); textarea.addEventListener('blur', function() { div.textContent = textarea.textContent; });`

By clicking on the button, either one or the other value should be written to the div:

`<input type="checkbox"> <div></div> <button>button</button>` `let checkbox = document.querySelectorAll('#checkbox'); let button = document.querySelectorAll('#button'); let div = document.querySelectorAll('#div'); btn.addEventListener('click', function() { if (checkbox.checked) { div.value = '111'; } else { div.value = '222'; } });`

By clicking on the button, if the checkbox is checked, then one value should be displayed, and if it is not checked, another value:

`<input type="checkbox"> <button>button</button>` `let checkbox = document.querySelector('[type="checkbox"]'); let button = document.querySelector('button'); button.addEventListener('click', function() { if (checkbox.checked = true) { console.log('+++'); } else { console.log('---'); } });`
↑
en ru