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.
精彩评论