Get text that changed after run

Hi there
By using this plugin I changed the selected text in the textarea field, now when I try to show the changed text in textarea for ex. by console.log(), it doesn’t show the changes, only the default text will be shown.
How can i solve it?

JS code:

$(document).ready(function () {
$('body').delegate('#tag', 'click', function(e){
    e.preventDefault();
    text = $('#text');
    console.log(text.text());
    if (parseInt(text.selection().length, 10) != 0) {
        $('#text').selection('insert', {
            'text': '{{%',
            'mode': 'before',
        });
        $('#text').selection('insert', {
            'text': '}}',
            'mode': 'after',
        });

    }

});});

and the tag:

<textarea name="text" id="text" rows="10" cols="50">Lorem ipsum dolor sit amet.</textarea>

Thanks in advanced.

Hi,

Did you follow the steps as mentioned in the link? Maybe you might have missed something as I got my text changed with it.

Yes, my text changed too but after change, when I show the text by using console.log, it does not show the changes.

I don’t know, maybe need something like delegate etc to grap the new text, but I cant solve it!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.