How do i set focus to a text box Html.TextBoxFor - mvc 2

Posted by Liado on Stack Overflow See other posts from Stack Overflow or by Liado
Published on 2010-06-01T16:11:12Z Indexed on 2010/06/01 16:13 UTC
Read the original article Hit count: 971

Filed under:
|
|
|

Hi, I'm trying to set focus on a text box which generated in the following way:

<%=Html.TextBoxFor(model => model.Email, new { style = "width:190px;Border:0px", maxsize = 190 })%>

i tried to use javascript which didnt help much.

var txtBox = document.getElementById("Email"); if (txtBox != null) txtBox.focus();

Can someone help? Thanks.

© Stack Overflow or respective owner

Related posts about html

Related posts about asp.net-mvc