2016-07-22 78 views
-3

我怎样才能获得一个默认的帮助文本(“在这里键入您的姓名”) @ Html.TextBoxFor/@ Html.Editorfor@ Html.TextBoxFor默认帮助文本

当用户点击打字箱,那么文字就会消失。

+1

请在提问前阅读[问]并尝试搜索。 – CodeCaster

回答

0

您只需在文本框中添加占位符html属性即可。

E.g.

@Html.TextBoxFor(m => m.Name, new { @placeholder = "Type your name"}) 
-2
<input type="text" id="myID" placeholder="Insert name here" /> 

占位符属性是你想要的。