I've tried with:
<form name="form" class="form-horizontal form-article" role="form" data-ng-submit="save()">
<div class="col-md-12">
<div class="form-group">
<div>
<input type="text" class="form-control" placeholder="Title" required="required" data-ng-model="article.title">
</div>
<span>*</span>
</div>
</form>
and
.form-article .form-group div:after {
color: red;
content: '*';
}
but the result is always
with like:
<form name="form" class="form-horizontal form-article" role="form" data-ng-submit="save()">
<div class="col-md-12">
<div class="form-group">
<div class="col-md-10">
<input type="text" class="form-control" placeholder="Title" required="required" data-ng-model="article.title">
</div>
<span class="col-md-2">*</span>
</div>
</form>
but the result is very ugly :(
Try using:
.form-group div{
position:relative;
margin-right:15px;
}
.form-group div:after{
position:absolute;
content:'*';
color:red;
right:-10px;
top:0;
}
nb. You also hadnt closed one of your div tags in your posted code.
Create a CSS class
.required-field:after {
color: #d00;
content: "*";
position: absolute;
margin-left: 3px;
top: 10px;
}
Use it just the label which is required
<div class="form-group">
<label for="EmployeeName" class="control-label required-field col-sm-2">Employee Name</label>
<div class="col-sm-4">
@Html.TextBoxFor(m => m.EmployeeName, new { @class = "form-control", ng_model = "Employee.EmployeeName", alpha_numeric = "", required = "true" })
</div>
<label for="" class="control-label required-field col-sm-2">Birth Date</label>
<div class="col-sm-4">
@Html.TextBoxFor(m => m.BirthDate, new { @class = "form-control", ng_model = "Employee.BirthDate", required = "true" })
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With