Witam.
Chciałbym wyświetlić alert po naciśnięciu przycisku "Zaloguj się" dla wybranego użytkownika np. "test". Alert powinien się wyświetlić jeśli w "TextBoxFor - nazwa użytkownika" wpiszemy "test", jeśli podamy innego użytkownika alert nie powinien się wyświetlić.
Pozdrawiam
@using (Html.BeginForm())
{
@Html.ValidationMessage("LoginError");
<div class="form-group">
<label>Nazwa użytkownika:</label>
@Html.TextBoxFor(m => m.Name, new { @class = "form-control", placeholder = "Nazwa użytkownika" })
@Html.ValidationMessageFor(m => m.Name)
</div>
<div class="form-group">
<label>Hasło:</label>
@Html.PasswordFor(m => m.Password, new { @class = "form-control", placeholder = "Hasło" })
@Html.ValidationMessageFor(m => m.Password)
</div>
<div class="form-group">
<label>
@Html.CheckBoxFor(m => m.Remember, new { @class = "form-check-label" })
Zapamiętaj mnie
</label>
</div>
<div class="form-group">
<input onclick="showAlert()" type="submit" value="Zaloguj się" class="btn btn-dark form-control" />
</div>
}
<script type="text/javascript">
showAlert = function () {
{
alert("alert")
}
</script>