Inserindo texto após a posição do cursor na área de texto
O script abaixo insere texto no final da área de texto. Preciso mudar para inserir texto após a posição atual do cursor na área de texto.
jQuery(document).ready(function($){
$('#addCommentImage').click(function(){
var imageLoc = prompt('Enter the Image URL:');
if ( imageLoc ) {
$('#comment').val($('#comment').val() + '[img]' + imageLoc + '[/img]');
}
return false;
});
});