"Kjeld 2"
Bootstrap 3.3.0 Snippet by jethrotenb

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <div class="control-group" id="fields"> <label class="control-label" for="field1">Nice Multiple Form Fields</label> <div class="controls"> <form role="form" autocomplete="off"> <div class="entry input-group col-xs-3"> <input class="form-control" type="text" /> </div> <div class="entry input-group col-xs-3"> <input class="form-control" type="text" id="jethro2" /> </div> <div class="entry input-group col-xs-3"> <input class="form-control" type="text" /> </div> <div class="entry input-group col-xs-3"> <input class="form-control" id="jethro" type="text" disabled /> <span class="input-group-btn"> <button class="btn btn-success btn-add" type="button" id="button2" class="button2"> <span class="glyphicon glyphicon-plus"></span> </button> </span> </div> </form> <br> <small>Press <span class="glyphicon glyphicon-plus gs"></span> to add another form field :)</small> </div> </div> </div> </div>
.entry:not(:first-of-type) { margin-top: 10px; } .glyphicon { font-size: 12px; }
$(function() { $(document).on('click', '.btn-add', function(e) { e.preventDefault(); $( "#jethro" ).prop( "disabled", false ); $("#button2").removeClass('btn-add').addClass('btn-remove') .removeClass('btn-success').addClass('btn-danger'); }).on('click', '.btn-remove', function(e) { $( "#jethro" ).prop( "disabled", true ); $("#jethro").val(""); $("#button2").removeClass('btn-remove').addClass('btn-add') .removeClass('btn-danger').addClass('btn-success'); e.preventDefault(); return false; }); });

Related: See More


Questions / Comments: