title: JavaScript, How to pre-populate a input field?
body: <p>I am trying to use some JavaScript for a checkbox. When a user makes the checkbox active there will be two fields displayed (This will be hidden soon). </p>
  
  <p>This is the JavaScipt so far for the checkbox:</p>
  
  <pre><code>    &lt;script&gt;
          function myFunction(cbox) {
              if (cbox.checked) {
                  var input = document.createElement("input");
                  input.type = "text";
                  var div = document.createElement("div");
                  div.id = cbox.name;
                  div.innerHTML = "Text to display for " + cbox.name;
                  div.appendChild(input);
                  document.getElementById("insertinputs").appendChild(div);
              } else {
                  document.getElementById(cbox.name).remove();
              }
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>As you can see when the user clicks the box it will display an input box, however, I cannot seem to get that pre-populated. What I mean in this is, I was using an HTML tag before the javascript witch logged the users Identity.</p>
  
  <pre><code>        &lt;input id="CheckedAndVerifiedBy" value="@User.Identity.Name" /&gt;
  </code></pre>
  
  <p>I would like the same thing to happen within the javascript, please help.</p>