According to https://docs.microsoft.com/en-us/aspnet/core/mvc/views/working-with-forms?view=aspnetcore-6.0#the-input-tag-helper, asp-for should change the input type attribute according to the bound property. However, that's not what I'm getting. I've created a new ASP.NET 6 (MVC) webapp and created a model:
public class MyModel
{
public double MyProperty { get; set; } = 1.45d;
}
and Index.cshtml to
@model MyModel;
<div class="text-center">
<input asp-for="MyProperty"/>
</div>
When I inspect the element with Firefox's dev tools, I get:
<input type="text" data-val="true" data-val-number="The field MyProperty must be a number." data-val-required="The MyProperty field is required." id="MyProperty" name="MyProperty" value="">
Shouldn't it be type=number?