2016-07-22 81 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" /> 

佔位符屬性是你想要的。