Mark a required label with an asterisk

Mark a required label with an asterisk

If you set the [Required] annotation on a required model property, the input field gets a data-val-required attribute in the view.

With this jQuery snippet an asterisk (“*”) gets appended to the corresponding label:

Thomas Bandixen's Picture

About Thomas Bandixen

Thomas Bandixen is an experienced senior consultant with a demonstrated history of working in the information technology and services industry. Skilled in Angular, TypeScript, ASP.NET (C#, Web API, MVC, ...), SQL and .NET Core Framework. Strong consulting professional with a Bachelor of Science (BSc) focused in Computer Science from ZHAW School of Engineering.

Switzerland https://thomasbandixen.ch