Examples

Dynamic textarea

    This example shows how to create a dynamic textarea and call Redactor on the fly.

    Demo

    Code

    <!-- element -->
    <div id="dynamic-layer"></div>
    
    <!-- build -->
    <script>
    document.addEventListener('DOMContentLoaded', function()
    {
        var textarea = document.createElement('textarea');
        textarea.value = 'Lorem ipsum...</p>';
    
        var layer = document.getElementById('dynamic-layer');
        layer.appendChild(textarea);
    
        // call Redactor
        $R(textarea, { focus: true });
    });
    </script>