vendredi 2 juin 2017

Checkbox not displaying value

I have set up a simple todo in vanilla js

http://ift.tt/2qOs6jf (quick side note, how do you get javascript and html linked in jsfiddle? doesn't seem recognize my function)

  let input = document.getElementById('todoInput').value;
  let checkbox = document.createElement("input")
  checkbox.type = 'checkbox'
  let label = document.createElement("label")
  label.textContent = input
  checkbox.appendChild(label)
  let output = document.getElementById('todoList');
  output.appendChild(checkbox)

however, locally I can get the checkbox appearing but no value next to it. I couldn't work out why and read somewhere I might need a label so have appended that and it is all coming through in the console correctly, just on the screen it displays a checkbox with nothing next to it?




Aucun commentaire:

Enregistrer un commentaire