I'm currently evaluating MarkdownDeep for use on my website. Above the editor I display a list of images the user previously uploaded. To insert the image (which is wrapped in a link to the larger version) into the <textarea>
, the user clicks the image. However, the live preview doesn't show the image until the user adds additional input in the <textarea>
. Is it possible to update the live preview through jQuery?
Here's the code I'm using to insert the image:
$("img").click(function () {
var imgsrc = $(this).attr('src');
var content = $('textarea').val();
$('textarea').val(content + '<a href="' + imgsrc + '"><img src="' + imgsrc + '" width="50" height="50" /></a>');
});