我们可以使用模式(正则表达式)进行输入控制 那样:
<input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three letter country code">
我的问题是我可以在@html.Editor中使用模式吗?
我试着用这种方式:
@Html.Editor("country_code", null, new { htmlAttributes = new { @class = "form-control" , required = "required" , pattern="[A-Za-z]{3}"} })
但 pattern =&#34; [A-Za-z] {3}&#34; 无法识别