"Untitled"
Bootstrap 4.1.1 Snippet by adarwash2012

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <form class="form-horizontal"> <fieldset> <!-- Form Name --> <legend>Form Name</legend> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="textinput">Text Input</label> <div class="col-md-4"> <input id="textinput" name="textinput" type="text" placeholder="placeholder" class="form-control input-md"> <span class="help-block">help</span> </div> </div> <!-- Multiple Checkboxes --> <div class="form-group"> <label class="col-md-4 control-label" for="checkboxes">Multiple Checkboxes</label> <div class="col-md-4"> <div class="checkbox"> <label for="checkboxes-0"> <input type="checkbox" name="checkboxes" id="checkboxes-0" value="1"> Option one </label> </div> <div class="checkbox"> <label for="checkboxes-1"> <input type="checkbox" name="checkboxes" id="checkboxes-1" value="2"> Option two </label> </div> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="textinput">Text Input</label> <div class="col-md-4"> <input id="textinput" name="textinput" type="text" placeholder="placeholder" class="form-control input-md"> <span class="help-block">help</span> </div> </div> <!-- Multiple Checkboxes (inline) --> <div class="form-group"> <label class="col-md-4 control-label" for="checkboxes">Inline Checkboxes</label> <div class="col-md-4"> <label class="checkbox-inline" for="checkboxes-0"> <input type="checkbox" name="checkboxes" id="checkboxes-0" value="1"> 1 </label> <label class="checkbox-inline" for="checkboxes-1"> <input type="checkbox" name="checkboxes" id="checkboxes-1" value="2"> 2 </label> <label class="checkbox-inline" for="checkboxes-2"> <input type="checkbox" name="checkboxes" id="checkboxes-2" value="3"> 3 </label> <label class="checkbox-inline" for="checkboxes-3"> <input type="checkbox" name="checkboxes" id="checkboxes-3" value="4"> 4 </label> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="textinput">Text Input</label> <div class="col-md-4"> <input id="textinput" name="textinput" type="text" placeholder="placeholder" class="form-control input-md"> <span class="help-block">help</span> </div> </div> <!-- Multiple Checkboxes --> <div class="form-group"> <label class="col-md-4 control-label" for="checkboxes">Multiple Checkboxes</label> <div class="col-md-4"> <div class="checkbox"> <label for="checkboxes-0"> <input type="checkbox" name="checkboxes" id="checkboxes-0" value="1"> Option one </label> </div> <div class="checkbox"> <label for="checkboxes-1"> <input type="checkbox" name="checkboxes" id="checkboxes-1" value="2"> Option two </label> </div> </div> </div> <!-- Multiple Checkboxes (inline) --> <div class="form-group"> <label class="col-md-4 control-label" for="checkboxes">Inline Checkboxes</label> <div class="col-md-4"> <label class="checkbox-inline" for="checkboxes-0"> <input type="checkbox" name="checkboxes" id="checkboxes-0" value="1"> 1 </label> <label class="checkbox-inline" for="checkboxes-1"> <input type="checkbox" name="checkboxes" id="checkboxes-1" value="2"> 2 </label> <label class="checkbox-inline" for="checkboxes-2"> <input type="checkbox" name="checkboxes" id="checkboxes-2" value="3"> 3 </label> <label class="checkbox-inline" for="checkboxes-3"> <input type="checkbox" name="checkboxes" id="checkboxes-3" value="4"> 4 </label> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="textinput">Text Input</label> <div class="col-md-4"> <input id="textinput" name="textinput" type="text" placeholder="placeholder" class="form-control input-md"> <span class="help-block">help</span> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="textinput">Text Input</label> <div class="col-md-4"> <input id="textinput" name="textinput" type="text" placeholder="placeholder" class="form-control input-md"> <span class="help-block">help</span> </div> </div> <textarea></textarea> </fieldset> </form> <button>save</button> </div>
$(function(){ $('button').on('click',function(){ $('input[type="text"]').each(function(i,e){ $current_value = $(this).val(); $(this).attr("value",$current_value) }) $('textarea').each(function(i,e){ $current_value = $(this).val(); $(this).text($current_value) }) }); $('input:checkbox').change( function(){ if ($(this).is(':checked')) { $(this).attr('checked','checked') } else { $(this).removeAttr( "checked" ) } }); })

Related: See More


Questions / Comments: