OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 8 Code distributed by Google as part of the polymer project is also |
| 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 |
| 14 <title>iron-form-element-behavior demo</title> |
| 15 |
| 16 <meta charset="utf-8"> |
| 17 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 18 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initia
l-scale=1, user-scalable=yes"> |
| 19 |
| 20 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 21 |
| 22 <link rel="import" href="../../paper-styles/demo-pages.html"> |
| 23 <link rel="import" href="simple-form.html"> |
| 24 <link rel="import" href="simple-element.html"> |
| 25 </head> |
| 26 <style> |
| 27 input { |
| 28 margin-bottom: 24px; |
| 29 width: 200px; |
| 30 } |
| 31 </style> |
| 32 <body> |
| 33 |
| 34 <div class="vertical-section-container centered"> |
| 35 <div class="vertical-section"> |
| 36 <form is="simple-form" id="form"> |
| 37 Element with iron-form-element-behavior <input is="simple-element" typ
e="text" name="one" value="one"> |
| 38 <br> |
| 39 Element without iron-form-element-behavior <input type="text" name="tw
o" value="two"> |
| 40 <br> |
| 41 Element with iron-form-element-behavior <input is="simple-element" typ
e="text" name="three" value="three"> |
| 42 </form> |
| 43 |
| 44 <h4>Elements tracked by the form: <button onclick="update()">Update</but
ton> </h4> |
| 45 |
| 46 <ul id="output"> |
| 47 </ul> |
| 48 </div> |
| 49 </div> |
| 50 |
| 51 <script> |
| 52 function update() { |
| 53 var output = document.getElementById('output'); |
| 54 var elements = document.getElementById('form').formElements; |
| 55 document.getElementById('output').innerHTML = ''; |
| 56 for (var i = 0; i < elements.length; i++) { |
| 57 var li = document.createElement('li'); |
| 58 var text = document.createTextNode(elements[i].value); |
| 59 li.appendChild(text); |
| 60 output.appendChild(li); |
| 61 } |
| 62 } |
| 63 </script> |
| 64 </body> |
| 65 |
| 66 |
| 67 </html> |
OLD | NEW |