"Form Registration"
Bootstrap 3.2.0 Snippet by junrillg

<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.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="form-box"> <h1>Form <span>Registration</span></h1> <form role="form" id="contact-form"> <!-- name field --> <div class="form-group"> <div id="nameError" class="alert" role="alert"></div> <label for="form-name-field" class="sr-only">Name</label> <div class="input-group"> <div class="input-group-addon"><span class="glyphicon glyphicon-user"></span></div> <input type="text" class="form-control" id="form-name-field" value="" placeholder="Name"> </div> </div> <!-- email field --> <div class="form-group"> <div id="emailError" class="alert" role="alert"></div> <label for="form-email-field" class="sr-only">Email</label> <div class="input-group"> <div class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span></div> <input type="email" class="form-control" id="form-email-field" value="" placeholder="Email"> </div> </div> <!-- phone field --> <div class="form-group"> <div id="phoneError" class="alert" role="alert"></div> <label for="form-phone-field" class="sr-only">Phone</label> <div class="input-group"> <div class="input-group-addon"><span class="glyphicon glyphicon-phone"></span></div> <input type="phone" class="form-control" id="form-phone-field" value="" placeholder="Phone"> </div> </div> <div class="checkbox"> <label> <input type="checkbox"> I agree to terms and condition. </label> </div> <button type="submit" class="btn btn-default">Submit</button> </form> </div> </div> </div>
body { background-color: lightblue; } .form-box { width: 50%; margin: auto; padding-top:20px; } .form-box h1 { text-align: center; font-weight: bold; text-transform: uppercase; color: tomato; } .form-box h1 span { font-weight: lighter; }
document.getElementById("contact-form").onsubmit = function() { var nameValidate = /[a-z]/; //Validate Name if(document.getElementById("form-name-field").value == "") { document.getElementById("nameError").innerHTML = "Please Enter A Name"; document.getElementById("nameError").className = "alert-danger"; } }

Related: See More


Questions / Comments: