mercredi 2 janvier 2019

button 'quote' & display into tinymce textarea

i just created a 'quote' button, when we press it, i want it take a text and put it in a textarea.

It works with a basic textarea but I still have a problem,

I use the editor 'Tinymce' .., & I can't put the text in this one ..

$(function() {

var $answer = $('#answer');
var $answerTa = $answer.find('textarea');

$('.quote').click(function(e) {
    var parent = $(this).parent();
    var postContent = parent.find('p').text();
    var quote = '[QUOTE]';
    quote += postContent+'[/QUOTE]';
    var answerTaContent = $answerTa.val();
    $answerTa.val(answerTaContent+quote);

    $('html, body').animate({
    scrollTop: 0},"slow");

});

});

If anyone could help me :/ thanks.




Aucun commentaire:

Enregistrer un commentaire