I want to add an input field dynamically to my page using the following jQuery:
var inputNode = "<input id='inputNode' class='tiContent' type='text'
placeholder='text input...'/>";
$("div").append(inputNode);
and after doing so, I want the input field to have focus with blinking text cursor, so I want to type in it right after creation.
Could someone please tell me how can I do this?
I've tried calling
$(inputNode).focus()
and also have tried
$(inputNode).trigger('click')
but none of them worked. I can type into the field after clicking in it, but as I've said I want to type without any interaction immediately.