Issue
I want to to add an eye on my bootstrap input as:
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="mb-3">
<label class="form-label" for="current">Current Password</label>
<input asp-for="ChangePassword.OldPassword" class="form-control" required autofocus />
<button class="btn btn-light shadow-none ms-0" type="button" id="password-addon" tabindex="99"><i class="fa fa-eye"></i></button>
<span asp-validation-for="ChangePassword.OldPassword" class="text-danger"></span>
</div>
Solution
Checkout input group, button addons: https://getbootstrap.com/docs/5.2/forms/input-group/#button-addons
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="mb-3">
<label class="form-label" for="current">Current Password</label>
<div class="input-group">
<input asp-for="ChangePassword.OldPassword" class="form-control" required autofocus />
<button class="btn btn-light shadow-none ms-0" type="button" id="password-addon" tabindex="99"><i class="fa fa-eye"></i></button>
</div>
<span asp-validation-for="ChangePassword.OldPassword" class="text-danger"></span>
</div>
Answered By - Arleigh Hix
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.