lundi 7 novembre 2016

Dynamic checkbox to hide dynamic inputbox

I'm rendering a dynamic input and checkbox from an array object which is fine, however I'm not quite sure how to hide the input when I click on the checkbox relative to the input.

 function dynamicStuff () {
  var objs = ['Id', 'Name', 'Age'];

      for (var i = 0; i < objs.length; i++) {
        objs[i];
        var cElement = document.createElement("input");
        cElement.type = "checkbox";
        cElement.name = objs[i];
        cElement.id = objs[i];

        var cElementInput = document.createElement("input");
        cElementInput.type = "text";
        cElementInput.name = objs[i];
        cElementInput.id = objs[i];
        cElementInput.placeholder = objs[i]
        document.getElementById('chkBox').appendChild(cElement); 
        document.getElementById('chkBox').appendChild(cElementInput); 
      }

    }

http://ift.tt/2efnC3F

How do I hide the input that I ticked and potentially save that input name/Id in the localStorage?




Aucun commentaire:

Enregistrer un commentaire