Swetha shetty
Swetha shetty

Reputation: 23

How to find out the cursor position for text editor using javascript

<textarea id="edit" name="editor" class="" onclick="myFunction()">
<? 
    if($content_id !='')
    {
        if($get_updated_templat['update_content'] == '')
        {
            foreach ($content_data_get as $key => $cont_nt_value) 
            {?>
                <h4><?=$content_subject[$key] ?></h4>
                <?=$cont_nt_value ?>
            <? }
        }
        else
        {?>
            <?=$get_updated_templat['update_content'];?>
        <? }
    }
    else
    {
        foreach ($template_data_get as $key => $cont_nt_value) 
            {?>
                <h4><?=$content_subject[$key]?></h4>
                <?=$cont_nt_value?>
            <? }
    }
?>
</textarea>

enter image description here

i am using WYSIWYG editor and display data in it which is saved in the backend table and try to add some some more data from modal for that i need to find out the cursor position but i can't able to find out the cursor position. Above code is the text editor code. I can easily able to find out the cursor position for input box and normal text area but for text editor i can't. Can some one help me to fix this issue. any help could be greatly appreciated.

Upvotes: 0

Views: 938

Answers (1)

Zoli Szab&#243;
Zoli Szab&#243;

Reputation: 4534

You should check out the official documentation of Froala editor. I think https://froala.com/wysiwyg-editor/docs/methods/#html.insert is the method you are looking for.

Upvotes: 0

Related Questions