I want to set focus to the textbox when i click the text box. I tried the below code but am not getting as expected .
$('#txtDate').focus();
Thanks in advance.
This will work
$('input').click(function() {
  $(this).focus();
})
                        Demo
Use Document.ready
 Try this..
 $(function(){
    $("#txtDate").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