how to validate hidden doms

mc 3,681 Reputation points
2023-05-29T09:27:54.4433333+00:00

I have a hidden value

<input type="hidden" asp-for="ImageUrl" />

<span asp-validator-for="ImageUrl" />

how to validate it?

jquery.validate will not validate the hidden doms.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,166 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,026 Reputation points
    2023-05-30T20:39:30.9+00:00

    to validate hidden fields, update the ignore selector which defaults to ":hidden".

    $('#myForm').validate().settings.ignore = ".ignore"; // require ignore class to ignore