Skip to content

Add placeholder string to your Codemirror editor

Learn how to add a placeholder string into your Codemirror editor. Placeholder is the text that appears in the editor when it’s empty and not focused.

We have already seen how to add CodeMirror editor into a TextArea element in this post. You can easily add a placeholder string to your CodeMirror editor using the placeholder plugin from the official CodeMirror repository.

Download the placeholder plugin and import it to your html.

<script src="placeholder.js"></script>

Add the placeholder text to your textarea.

 <textarea id="code" name="code" placeholder="Please enter your address here..">

You can see the placeholder string in the editor.

See also  Add Google Fonts to your web page

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.