JSFiddle - React, Tailwind, and code Playground
HTML
<!-- Bootstrap core CSS -->
<div class="panel panel-default">
<div class="panel-heading">Additional Authors</div>
<div class="panel-body">
<input id="addAuthorButton" type="button" value="Add Author" class="btn btn-lg btn-default btn-block" />
<div id="additionalAuthorsTextboxes">
</div>
</div>
</div>
CSS
@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css');
@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css');
JavaScript
$(document).ready(function(){
var counter = 0;
$("#addAuthorButton").click(function () {
if(counter==5){
alert("Only 5 additional authors allowed.");
return false;
}
counter++;
var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'additionalAuthor' + counter).attr("class", 'additionalAuthor input-group');
newTextBoxDiv.after().html("<span class='input-group-addon'><span class='glyphicon glyphicon-user'></span></span><input class='form-control' type='text' placeholder='Author Name'><span class='input-group-addon'><span style='color: red;' class='glyphicon glyphicon-remove removeAdditionalAuthor'></span></span>");
newTextBoxDiv.appendTo("#additionalAuthorsTextboxes");
});
$(".removeAdditionalAuthor").click(function () {
alert("hopefully i dont see this.");
$(this).closest('div').remove();
});
});