Q:

How to give a JS command to put a cursor inside an input box?

I have a simple text input field:

<input value="Hello">

I want to write a JS code that place the focus on the input box and put a cursor inside. 
I tried to use focus() in JQuery: 
$('document').ready(function(){
   $($('input')[0]).click(function() {
      this.focus();
   })
})

and it didn't work. 

A:

You have to access input element using a simple selector: $('input'). Then, you have to bind an event handler to the focus JavaScript event.
$('document').ready(function(){
   $('input').focus();
});

