gpt4 book ai didi

html - 在 Asp.Net MVC core 2.2 中使用标签助手时删除 chrome 中的自动日期选择器

转载 作者:可可西里 更新时间:2023-11-01 13:41:27 24 4
gpt4 key购买 nike

在我的 asp.net core 2.2 应用程序中使用以下标签助手,Chrome 显示了一个 html5 日期选择器(如图所示)。

    <div class="col-md-6 input-group-sm">
<label asp-for="Dob"></label>
<input asp-for="Dob" class="form-control"/>
<span asp-validation-for="Dob" class="text-danger"></span>
</div>

DOB 的模型属性是 -

public DateTime? Dob { get; set; }

chrome 中生成了什么 -

enter image description here

这不会发生在 Internet Explorer 中,我可以看到这是由于 chrome 在 html 中添加了 type="datetime-local"。

问题

有没有办法删除这个自动生成的日期选择器,以便我可以使用替代方法?

最佳答案

您可以简单地使用 type="text" 删除默认的 type="datetime-local"

<input type="text" asp-for="Dob" class="form-control"/>

关于html - 在 Asp.Net MVC core 2.2 中使用标签助手时删除 chrome 中的自动日期选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56791116/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com