CMIContent Marketing InstituteContent directory

News · General · Archive

CodeMirror: Placeholder demo

Home News

.CodeMirror { border: 1px solid silver; } .CodeMirror-empty { outline: 1px solid #c22; } .CodeMirror-empty.CodeMirror-focused { outline: none; } .CodeMirror pre.CodeMirror-placeholder { color: #999; }

CodeMirror

Home Manual Code

Placeholder

Placeholder demo

The placeholder plug-in adds an option placeholder that can be set to make text appear in the editor when it is empty and not focused. If the source textarea has a placeholder attribute, it will automatically be inherited.

var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true });

More in Archive · More in General · More in News