Home > Code > Javascript > Setting focus to textbox control using JavaScript

Setting focus to textbox control using JavaScript

by Narain Siddharth   on Nov 13, 2010   Category: Javascript   |  Views: 5473    |  Points: 25   |  Silver 


1. Below code snippet is used to set the focus to the textbox control by using JavaScript

document.getElementById(“TextboxControlName”).focus();

2. Using RegisterStartupScript in Code behind

Page.RegisterStartupScript("Focus", "<script language=""Javascript"" > document.getElementById("TextboxControlName").focus(); </Script>")





Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts