在我使用的 MVC 剃刀视图中@Html.RadioButtonFor
。我想使用 aria-label 作为屏幕阅读器,但不知道如何使用它。
如果我添加aria-label
然后我得到The name 'aria' does not exist in current context
error.
@Html.RadioButtonFor(options => options.SelectedFulfillmentType, option, new { id = id, required = "required", @class = option.GetDisplayName().ToLower().Replace(" ", "-") + "-input", aria-label = "Test"})
如果我添加aria_label
然后我没有收到任何错误,但我在浏览器上没有看到该标签。
@Html.RadioButtonFor(options => options.SelectedFulfillmentType, option, new { id = id, required = "required", @class = option.GetDisplayName().ToLower().Replace(" ", "-") + "-input", aria_label = "Test"})