Я пытаюсь скрыть и показать 2 разных элемента при нажатии на кнопку. Он не работает.
, когда я нажимаю кнопку Удалить, скрывает, но не подтверждает verifyDeleteSpan.
Пожалуйста, помогите.
Вот HTML
<div class="card-footer">
<form asp-action="DeleteUser" asp-route-id="@user.Id" method="post">
<a asp-action="EditUser" asp-controller="Administration"
asp-route-id="@user.Id" class="btn btn-outline-danger">Edit</a>
<span id="confirmDeleteSpan_@user.Id" style="display:none" >
<span> Are you sure you want to delete</span>
<button type="submit" class="btn btn-danger">Yes</button>
<a href="#" class="btn btn-primary"
onclick="confirmDelete('@user.Id', false)">No</a>
</span>
<span id="deleteSpan_@user.Id">
<a href="#/" class="btn btn-danger"
onclick="confirmDelete('@user.Id', true)">Delete</a>
</span>
</form>
</div>
Вот скрипт JQUERY:
function confirmDelete(uniqueId, isTrue) {
var deleteSpan = 'deleteSpan_' + uniqueId;
var confirmDeleteSpan = 'confirmDeletespan_' + uniqueId;
if (isTrue) {
$('#' + deleteSpan).hide("slow");
$('#' + confirmDeleteSpan).show();
} else {
$('#' + deleteSpan).show("slow");
$('#' + confirmDeleteSpan).hide();
}
}
Вот источник просмотра
<div class="card-footer">
<form method="post" action="/Administration/DeleteUser/ccebd1b9-1a85-46e4-b4a1-5e73e9734ba7">
<a class="btn btn-outline-danger" href="/Administration/EditUser/ccebd1b9-1a85-46e4-b4a1-5e73e9734ba7">Edit</a>
<span id="confirmDeleteSpan_ccebd1b9-1a85-46e4-b4a1-5e73e9734ba7" style="display:none">
<span> Are you sure you want to delete</span>
<button type="submit" class="btn btn-danger">Yes</button>
<a href="#" class="btn btn-primary"
onclick="confirmDelete('ccebd1b9-1a85-46e4-b4a1-5e73e9734ba7', false)">No</a>
</span>
<span id="deleteSpan_ccebd1b9-1a85-46e4-b4a1-5e73e9734ba7">
<a href="#/" class="btn btn-danger"
onclick="confirmDelete('ccebd1b9-1a85-46e4-b4a1-5e73e9734ba7', true)">Delete</a>
</span>
<input name="__RequestVerificationToken" type="hidden" value="CfDJ8CFNAH60_plMlRrZQdMVKfL3M75wB5l7cYhvyqKtgU0iMsX0rPzU0T6yG1eRaGRT2jqbJUpi6vcM1r-nDfFymtVtqi1P2fUvBEhzU5-EgvZ9Mi4_SiLjse4-0LBpPTSrEHeXtjKdPvUvEcYyNtw7Xe1nTTX0tVmoSpaYkKqFjT_SdsAxEQjbxAfVU1nqJBho8w" /></form>
</div>
</div>