Upload and insert into text area
I have wrote a very simple php upload. But I w开发者_开发技巧ant to insert image in text area with "click". I want to do this with jquery.
Is there any jquery plugin for do this? (or an application for upload like in stackoverflow)? Thanks in advance
Check http://elrte.org/. It's a jQuery WYSIWYG editor with files manager.
After submit (some help about that in here) call to the rich text area and insert the img tag, something like this:
$('#imageform').bind('submit', function(e) {
e.preventDefault(); // <-- important
$(this).ajaxSubmit({
target: '#preview',
success: function() {
$('#richtext_area').html('<img id"newimg" src="" alt="your file"/>');
$('#newimg').attr("src",$("#filePath_text").val())
}
});
}).submit();
Look up TinyMCE - it's not part of jQuery, but, it's a JS library that gives you a WYSIWYG editor with image control.
Try CKEditor, it's even working with jQuery too.
精彩评论