How to set focus after the text in the textbox
This code demonstrate how to set focus after the text in the textbox.
Design code :
<input type="button" id="idbtn" value="Set" onclick="func();" /> <asp:TextBox ID="TextBox1" runat="server" Text="hi"></asp:TextBox>
JavaScript code :
<script language="javascript">
function func()
{
var txt1= document.getElementById("TextBox1");
txt1.focus();//set focus
txt1.value = txt1.value; //set value
}
</script>
Thanks,
Abhay
Comments
Post a Comment