How to make display the code as code after pasting the code in textarea

Viewed 32

I want to display the code as code by onkeyup event in the textarea which something looks like online compilers without compiling anything, I'm using code-prettify which is this lib : <script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>

What I want to do when the user pastes his code in the textarea the code appears as code

the way it appears in one is by using prettyprint class: <pre class="prettyprint"> <code class="prettyprint "> <p> <?php echo htmlspecialchars($str); ?>

I don't mind using any other libraries

enter image description here

1 Answers
Related