<div class="col-md-6" id="newtextbox"> <label>HTS Code:</label> <button type="button" value="add" class="add" id="add"> <i class="icon-plus-circle2"></i></button> <div class="input-group"> <span class="input-group-addon"> <input type="checkbox" class="styled" name="input-addon-checkbox" > </span> <input type="text" class="form-control" placeholder="35702.03.012"> </div> </div>
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jQuery Show Popup on Page Load</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script> <style type="text/css"> body { font-family:Gill Sans MT; padding:10px; } fieldset { border: solid 1px #000; padding:10px; display:block; clear:both; margin:5px 0px; } legend { padding:0px 10px; background:black; color:#FFF; } input.add { float:right; } input.fieldname { float:left; display:block; margin:5px; } input.fieldcheck { float:left; display:block; clear:left; margin:5px; margin-top:10px; } select.fieldtype { float:left; display:block; margin:5px; } input.remove { float:left; display:block; margin:5px; } #yourform label { float:left; clear:left; display:block; margin:5px; } #yourform input, #yourform textarea { float:left; display:block; margin:5px; } </style> <script type='text/javascript'> $(document).ready(function() { $("#add").click(function() { var intId = $("#buildyourform div").length + 1; var fieldWrapper = $("<div class=\"fieldwrapper\" id=\"field" + intId + "\"/>"); var fchk = $("<input type=\"checkbox\" class=\"fieldcheck\" /> ") var fName = $("<input type=\"text\" class=\"fieldname\" />"); var removeButton = $("<input type=\"button\" class=\"remove\" value=\"-\" />"); removeButton.click(function() { $(this).parent().remove(); }); fieldWrapper.append(fchk); fieldWrapper.append(fName); fieldWrapper.append(removeButton); $("#buildyourform").append(fieldWrapper); }); }); </script> </head> <body> <input type="button" value="Add a field" class="add" id="add" /> </body> </html>
<div id="buildyourform"></div>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)