Click here to Skip to main content
15,560,073 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'm working on my ASP.NET Core MVC project. I want to show all the ASP Validation Summaries in my register/login form in a Bootstrap alert. I used JQuery for this purpose but it does not work. When I open the login/register page, there is a red empty rectangle (Bootstrap Alert) in the summary area.
Please guide me.

What I have tried:

Code for Alert:
<div class="alert alert-danger" id="alert" role="alert" asp-validation-summary=All></div>


JQuery script:

<script>
        $(document).ready(function(){
            if($('#alert').is(':empty')){
                $('#alert').hide();
            }else{
                $('#alert').show();
            }
        });
</script>
Posted
Updated 1-Dec-21 23:20pm
v3

1 solution

I used character count to get the expected result and the problem solved.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900