I am using VUEjs 2. First steps in programming. Any other better way to achieve this would be appreciated. I am creating a form creator here I have the code in jsBin link I need help in creating the checkboxes . Thank you very much in advance. * First time I write in Stack * The problem is that when cloning the input it is already with the text that you have written in the cloned input.
Div Cloned:
<div id="option" class="input-group form-group">
<input id="" type="text" class="form-control input-sm" placeholder="Option" value="">
<span class="input-group-btn">
<button type="button" class="btn waves-effect btn-default btn-sm"><i class="glyphicon glyphicon-remove text-danger"></i></button>
</span>
</div>
<div id="newOptions"> <!-- Div's clonados -->
</div>
<div class="pull-right">
<button type="button" class="btn waves-effect btn-success btn-xs" @click="addOption"><i class="glyphicon glyphicon-plus-sign"></i> Add option</button>
</div>
This is my JS
addOption: function(){
var el = document.getElementById("option");
var divClone = el.cloneNode(true),
elChild = document.createElement("div");
document.getElementById("newOptions").appendChild(divClone);
},