Insert HTML and text

This example shows how to use API for inserting text or HTML at the caret.

    Demo


    Code

    <!-- api buttons -->
    <button onclick="$R('#content', 'insertion.insertText', '<p>...</p>');">Text</button>
    <button onclick="$R('#content', 'insertion.insertHtml', '<p>...</p>');">HTML</button>
    
    <!-- element -->
    <textarea id="content"></textarea>
    
    <!-- call -->
    <script>
    $R('#content');
    </script>