1
0

placeholder.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Placeholder demo</title>
  6. <link rel="stylesheet" href="../lib/codemirror.css">
  7. <script src="../lib/codemirror.js"></script>
  8. <script src="../addon/display/placeholder.js"></script>
  9. <link rel="stylesheet" href="../doc/docs.css">
  10. <style type="text/css">
  11. .CodeMirror { border: 1px solid silver; }
  12. .CodeMirror-empty { outline: 1px solid #c22; }
  13. .CodeMirror-empty.CodeMirror-focused { outline: none; }
  14. .CodeMirror pre.CodeMirror-placeholder { color: #999; }
  15. </style>
  16. </head>
  17. <body>
  18. <h1>CodeMirror: Placeholder demo</h1>
  19. <form><textarea id="code" name="code" placeholder="Code goes here..."></textarea></form>
  20. <p>The <a href="../doc/manual.html#addon_placeholder">placeholder</a>
  21. plug-in adds an option <code>placeholder</code> that can be set to
  22. make text appear in the editor when it is empty and not focused.
  23. If the source textarea has a <code>placeholder</code> attribute,
  24. it will automatically be inherited.</p>
  25. <script>
  26. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  27. lineNumbers: true
  28. });
  29. </script>
  30. </body>
  31. </html>