ASP.NET MVC Required Field Indicator

前端 未结 6 2395
我在风中等你
我在风中等你 2020-12-15 00:17

For fields in my ASP.NET MVC view that have been attributed as required, is there any way for the framework to render some sort of indicator automatically that the field is

6条回答
  •  独厮守ぢ
    2020-12-15 01:09

    A Small Modification Is Done From My Side. Actually I had primary keys (Identity Columns in DB). That I did no want to highlight. So I Used Below Code Snippet to select only input[type=text] fields that has required attribute in annotation.

    $("[data-val-required]").not(":hidden").not(":radio").not(":checkbox").after('*');
    

提交回复
热议问题