开发者

Watermark Problem with Internet Explorer

In my model I have

[Display(Prompt="Author First Name",Name="First Name")]
[StringLength(100,ErrorMessage="First Name may not be longer than 100 characters")]
public string AuthFirstName { get; set; }

I have a String.cshtml file that is

@Html.TextBox("",ViewData.TemplateInfo.FormattedModelValue, new { @class="text-box single-line", placeholder = ViewData.Model开发者_如何学GoMetadata.Watermark })

In firefox and chrome when my form is displayed it correctly shows the watermark everytime. For some reason I cannot get them to show in Internet Explorer and unfortunatly most of my user base will be using this browser. I did install chrome frame and with that installed I get the watermark in IE but this may not be the most ideal solution for my many non technical users.

Thanks in Advance!


Placeholders are only planned to be supported in IE10.
See http://caniuse.com/#search=placeholder

What you can do is to detect browser native support for placeholders using JavaScript, and if there is no support, fallback to a JavaScript implementation.

Here's an example using Modernizr for support detection and a jQuery plugin for the placeholder implementation: http://plugins.jquery.com/project/HTML5izerPlaceholder

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜