Dear JavaScript Expert.
I would like the cursor / caret to be focused in my newly created text area when the below event is triggered. For some reasons it's not happening. Perhaps I am not understanding the jQuery documentation. Can you see the below code and advise?
Thank you.
Code:$(".addTextArea").click(function(){ var $this = $(this); //clone a new textArea var $textArea= $("#textAreaTemplate").clone(true); //assign a unique identifier. Note intID is a global incrementer. In the actual code it gets incremented. $textArea.attr("id", "textArea" + intId); //*** doesn't put the caret into the new text Area. $this.parent().after($textArea).focus(); //*** this doesn't work either $("#textArea" + intId).focus(); });


Reply With Quote

Bookmarks