How can I set focus on asp:TextBox which is placed inside a user control by using jquery/JavaScript function in aspx page?
You can use id selector and use focus() method. For using jQuery you need to include jQuery and ensure your element is available in DOM
before you access it. You can use document.ready for that.
$('#txt1').focus();
Or using plain JavaScript, focus()
document.getElementById('txt1').focus();
If you do not have ClientIDMode = static then you will need to use ClientID
$('#<%= txt1.Client %>').focus();
You can try with jQuery :
$('#txt').focus();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With