Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
<div class="card col-lg-8">
  <civ class="card-body">
    <h5><div class="card-header">My tricked out form
                        <div class="alert alert-success alert-dismissible fade show" role="alert" id="success_message" style="display:none; "> 
                      <h3>Great!</h3> Form has been submitted successfully. You may now enter the site. 
                      <button id="successalert" type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    </div>
                    <div class="alert alert-warning alert-dismissible fade show" role="alert" id="error_message" style="display:none; "> 
                      <h3>Error!</h3> You have missing responses. 
                      <button id="warningalert" type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                   </div>
      </div></h5>
<form class="needs-validation" novalidate>
  <div class="form-row">
    <div class="col-md-4 mb-3">
      <label for="validationTooltip01">First name</label>
      <input type="text" class="form-control" id="validationTooltip01" placeholder="First name" value="Mark" required>
      <div class="valid-feedback">
        Looks good!
      </div>
      <div class="invalid-feedback">
        Please enter your name.
      </div>      
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationTooltip02">Last name</label>
      <input type="text" class="form-control" id="validationTooltip02" placeholder="Last name" value="Otto" required>
      <div class="valid-feedback">
        Looks good!
      </div>
      <div class="invalid-feedback">
        Please enter your last name.
      </div>  
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationTooltipUsername">Username</label>
      <div class="input-group">
        <div class="input-group-prepend">
          <span class="input-group-text" id="validationTooltipUsernamePrepend">@</span>
        </div>
        <input type="text" class="form-control" id="validationTooltipUsername" placeholder="Username" aria-describedby="validationTooltipUsernamePrepend" required>
        <div class="valid-feedback">
        Looks good!
      </div>
        <div class="invalid-feedback">
          Please choose a unique and valid username.
        </div>
      </div>
    </div>
  </div>
  <div class="form-row">
    <div class="col-md-6 mb-3">
      <label for="validationTooltip03">City</label>
      <input type="text" class="form-control" id="validationTooltip03" placeholder="City" required>
      <div class="valid-feedback">
        Looks good!
      </div>
      <div class="invalid-feedback">
        Please provide a valid city.
      </div>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationTooltip04">State</label>
      <input type="text" class="form-control" id="validationTooltip04" placeholder="State" required>
      <div class="valid-feedback">
        Looks good!
      </div>
      <div class="invalid-feedback">
        Please provide a valid state.
      </div>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationTooltip05">Zip</label>
      <input type="text" class="form-control" id="validationTooltip05" placeholder="Zip" required>
      <div class="valid-feedback">
        Looks good!
      </div>
      <div class="invalid-feedback">
        Please provide a valid zip.
      </div>
    </div>
  </div>
    <div class="form-group formbtns">
    <div class="form-check form-check-inline">
      <apan id="tandppop" class="d-inline-block" data-toggle="popover" data-placement="auto" title="Hold on slick" data-content="You have to read the Terms and Privacy before you can check the box. Yes. It's required">
      <input name="tcheck" class="form-check-input" type="checkbox" value="" style="pointer-events: none;"id="invalidCheck" disabled required >
        <label class="form-check-label" for="invalidCheck">
        <button id="tandpbtn" type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#tandpmodal">Agree to terms and privacy</button>
      </label>
       
      <div class="invalid-feedback">
        You must agree before submitting.
      </div>
    </div>     
  </div>
      </apan>
  <div class="card-footer">
  <button class="btn btn-primary" type="submit">Submit form</button>
    <span id="sitebtntip" class="d-inline-block" tabindex="0" data-toggle="tooltip" title="Form must be valid first">
      <a id="sitebtn" class="btn btn-primary disabled" href="#" role="button" aria-disabled="true" style="pointer-events: none;">Enter Site</a></span>
  </div>
</form>
  </div>
</div>
</div>

<div id="tandpmodal" class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="tandpmodal" aria-hidden="true">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Terms and Privacy</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
<div id="accordion">
  <div class="card">
    <div class="card-header" id="headingOne">
      <h5 class="mb-0">
        <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Terms and Conditions
        </button>
      </h5>
    </div>

    <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
      <div class="card-body">
<ul class="list-group">
  <li class="list-group-item">Cras justo odio</li>
  <li class="list-group-item">Dapibus ac facilisis in</li>
  <li class="list-group-item">Morbi leo risus</li>
  <li class="list-group-item">Porta ac consectetur ac</li>
  <li class="list-group-item">Vestibulum at eros</li>
</ul>
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingTwo">
      <h5 class="mb-0">
        <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Privacy Policy
        </button>
      </h5>
    </div>
    <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
      <div class="card-body">
<ul class="list-group">
  <li class="list-group-item">Cras justo odio</li>
  <li class="list-group-item">Dapibus ac facilisis in</li>
  <li class="list-group-item">Morbi leo risus</li>
  <li class="list-group-item">Porta ac consectetur ac</li>
  <li class="list-group-item">Vestibulum at eros</li>
</ul>
      </div>
    </div>
  </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>

              
            
!

CSS

              
                body {background-color: #B0BEC5;}

.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
ul li.list-group-item { 
    list-style: decimal inside;
    display: list-item;
}
.form-control {
  background-color: #f5f5f5;
}
.form-control:focus {
  background-color: #ffffff;
}
.right {
  float: right;
}
.formbtns {
  display: flex;
  justify-content: space-around;
}
.popover {
    background-color: #f8f9fa;
}
.popover-header {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}
.card-footer {
  display: flex;
  justify-content: space-between;
}


            
              
            
!

JS

              
                // Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
  'use strict';
  window.addEventListener('load', function() {
    // Fetch all the forms we want to apply custom Bootstrap validation styles to
    var forms = document.getElementsByClassName('needs-validation');
    // Loop over them and prevent submission
    var validation = Array.prototype.filter.call(forms, function(form) {
      form.addEventListener('submit', function(event) {
        if (form.checkValidity() === false) {        
         $('#error_message').show();
          event.preventDefault();
          event.stopPropagation();
        }
        form.classList.add('was-validated');
 if (form.checkValidity() === true) {
     event.preventDefault();
     event.stopPropagation();
     $('#success_message').show();
   $("#sitebtn").removeClass("disabled");
$("#sitebtn").css("pointer-events","auto");
     request.doSubmit();
       }
      }, false);
    });
  }, false);
})();
$( "#tandpbtn" ).click(function() {
$("#invalidCheck").prop("disabled",false); 
$('#tandppop').popover('dispose');
$("#invalidCheck").css("pointer-events","auto"); $("#sitebtntip").tooltip('dispose');
});

//Using localstorage to remember checkbox value
$(function() {
        var data = localStorage.getItem("tcheck");
        if (data !== null) {
            $("input[name='tcheck']").attr("checked", "checked");         $("#invalidCheck").prop("disabled",false); 
$('#tandppop').popover('dispose');
$("#invalidCheck").css("pointer-events","auto");
        }
    });
    $("input[name='tcheck']").click(function() {
        if ($(this).is(":checked")) {
            localStorage.setItem("tcheck", $(this).val());
        } else {
            localStorage.removeItem("tcheck");
$("#invalidCheck").css("pointer-events","none");          $("#invalidCheck").prop("disabled",true);
 $('#tandppop').popover('enable');         
        }
    });
//initialize popover and tooltip
$(function () {
  $('[data-toggle="popover"]').popover()
})
$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})



              
            
!
999px

Console