JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.14.0/jquery.validate.min.js"></script>
<form class="cmxform" id="dischargeform" method="post">
<p>
<label for="firstname">Firstname</label>
<input id="firstname" name="firstname" type="text" class="form-control">
</p>
<p>
<label for="lastname">Lastname</label>
<input id="lastname" name="lastname" type="text" class="form-control">
</p>
<p>
<input class="btn btn-primary" type="submit" value="Submit">
</p>
</form>
<!-- modal -->
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h3 id="myModalLabel3">Confirmation Heading</h3>
</div>
<div class="modal-body">
<p>Are You Sure You want To submit The Form</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close This Modal</button>
<button class="btn-primary btn" id="SubForm">Confirm and Submit The Form</button>
</div>
</div>
</div>
</div>
<!-- end modal -->
JavaScript
$("#dischargeform").validate({
rules: {
firstname: "required",
lastname: "required",
},
messages: {
firstname: "Please enter your firstname",
lastname: "Please enter your lastname",
},
submitHandler: function(form) {
$("#myModal").modal('show');
$('#SubForm').click(function() {
form.submit();
});
}
});