Hi i would like my validation to have an asterisk * when user press the button can it be possible that the label will appear at a label with * and a right a small text on the top left appear saying * is mandatory?
Here my code below
(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) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
<form class="needs-validation" novalidate>
<div class="form-group row">
<label for="validationName" class="col-2 col-form-label">Name:</label>
<div class="col-10">
<input name="validationName" type="text" class="form-control" id="validationName" placeholder="Company Name" required>
<div class="invalid-feedback">
Enter a correct Company Name!
</div>
</div>
</div>
<div style="left: 1175px; top: 550px;" class="form-group ">
<button class="btn btn-primary btn-lg float-right" type="submit">Add</button>
</div>
</form>