开发者

MVC TextBoxFor onfocus style

I'm not very skillful with HTML, but I want to change the style when a TextBoxFor got t开发者_C百科he focus. I tried this:

@Html.TextBoxFor(model => model.Nombre, new { id = "fname", onfocus="setStyle(this.id)" })

But I'm getting an error. What should I do?


You could try using css:

input[type=text]:focus
{
    background:red;
}

For :focus to work in IE8, a !DOCTYPE must be declared.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜