Return focus at the end of the text at text area after closing jQuery colorbox -


this bugging me. have application launches jquery colorbox , insert content text area editor closes line:

$.colorbox.close(); 

the problem not return focus or mouse cursor blink @ end of inserted content. how in jquery? add code after closing colorbox. not figure out. help.

it wordpress text editor can selected with:

$('#content') 

i have tried after colorbox close:

$('#content').focus(); 

it not work.

the trick add colorbox onclosed event (replace #content id of text area:

                onclosed: function() {                      //assign focus after inserting content                      var content_inserted = $("#content").val();                     $("#content").focus().val("").val(content_inserted);                      } 

take note cannot rely on:

$('#content').focus(); 

even inside onclosed event since not put cursor @ end of inserted text on other browsers chromium or chrome. need reset text area content under focused first insert it.


Comments