开发者

MVC TextBoxFor onfocus style

开发者 https://www.devze.com 2023-03-03 00:32 出处:网络
I\'m not very skillful with HTML, but I want to change the style when a TextBoxFor got t开发者_C百科he focus.

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

精彩评论

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