【发布时间】:2011-07-09 08:58:11
【问题描述】:
下面的脚本将文本插入到文本区域的末尾。我需要更改为 在文本区域中当前光标位置之后插入文本。
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;
});
});
【问题讨论】:
标签: jquery textarea javascript