When ever i click the add button it makes the previous value disappear. Example if i click add first time and enter the values in the first input boxes. and the click the add button it is making the previous values disappear from the input boxes
function addInput(event) {
var field =
'<div class="form-group"><input type="text" class="form-control" name="selected_text" placeholder="Selected Text"></div>' +
'<div class="form-group"><input type="text" class="form-control" name="selected_route_url" placeholder="Route Url for selected text"></div>' +
'<div class="form-group"><input type="text" class="form-control" name="unselected_text" placeholder="UnSelected Text"></div>' +
'<div class="form-group"><input type="text" class="form-control" name="unselected_route_url" placeholder="Route Url for unselected text"></div>'
document.getElementById('inputField').innerHTML += field;
event.preventDefault();
}
<div class="form-group">
<a class="btn btn-primary pull-left" onclick="addInput(event)">Add</a>
</div>
<div id="inputField" style="background-color:#eceff1;">
</div>