Examples

Get and set code

    This example shows how to use API for getting and setting the Redactor's code.

    Demo

    Click to buttons and see the console log for results.

     

    Code

    <!-- api buttons -->
    <button onclick="console.log($R('#content', 'source.getCode'));">Get</button>
    <button onclick="$R('#content', 'source.setCode', '<p>...</p>');">Set</button>
    
    <!-- element -->
    <textarea id="content"></textarea>
    
    <!-- call -->
    <script>
    $R('#content');
    </script>