labelinput.html 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!DOCTYPE html>
  2. <html>
  3. <!--
  4. Copyright 2010 The Closure Library Authors. All Rights Reserved.
  5. Use of this source code is governed by the Apache License, Version 2.0.
  6. See the COPYING file for details.
  7. -->
  8. <head>
  9. <title>goog.ui.LabelInput</title>
  10. <link rel="stylesheet" href="css/demo.css">
  11. <style>
  12. .label-input-label {
  13. color: GrayText;
  14. }
  15. </style>
  16. <script src="../base.js"></script>
  17. <script>
  18. goog.require('goog.ui.LabelInput');
  19. goog.require('goog.dom');
  20. </script>
  21. </head>
  22. <body>
  23. <h1>goog.ui.LabelInput</h1>
  24. <p>This component decorates an input with default text which disappears upon focus.</p>
  25. <form>
  26. <input id=i name=i label='Search, add, or invite 1'>
  27. <div id=d></div>
  28. <script>
  29. var $ = goog.dom.getElement;
  30. var li1 = new goog.ui.LabelInput;
  31. li1.decorate($('i'));
  32. var li2 = new goog.ui.LabelInput('Search, add, or invite 2');
  33. var el = li2.render($('d'));
  34. li2.getElement().name = 'dynamic';
  35. </script>
  36. <button type="button">Faux Submit</button>
  37. </form>
  38. </body>
  39. </html>