Lo script seguente inserisce il testo alla fine dell'area di testo. Devo passare a inserire il testo dopo la posizione corrente del cursore nell'area di testo.Inserimento di testo dopo la posizione del cursore nel testo
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;
});
});
possibile duplicato di [Inserire testo in textarea con jQuery] (http://stackoverflow.com/questions/946534/insert-text-into-textarea-with-jquery) – bummi