crop_rotate
Run
<!DOCTYPE html> <html> <body> <ul id="myList"> <li>Coffee</li> <li>Tea</li> </ul> <p>Click the button to insert an item to the list.</p> <button onclick="myFunction()">Try it</button> <p><strong>Example explained:</strong><br>First create a LI node,<br> then create a Text node,<br> then append the Text node to the LI node.<br>Finally insert the LI node before the first child node in the list.</p> <script> function myFunction() { var newItem = document.createElement("LI"); var textnode = document.createTextNode("Water"); newItem.appendChild(textnode); var list = document.getElementById("myList"); list.insertBefore(newItem, list.childNodes[0]); } </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8dWwgaWQ9Im15TGlzdCI+DQogIDxsaT5Db2ZmZWU8L2xpPg0KICA8bGk+VGVhPC9saT4NCjwvdWw+DQoNCjxwPkNsaWNrIHRoZSBidXR0b24gdG8gaW5zZXJ0IGFuIGl0ZW0gdG8gdGhlIGxpc3QuPC9wPg0KDQo8YnV0dG9uIG9uY2xpY2s9Im15RnVuY3Rpb24oKSI+VHJ5IGl0PC9idXR0b24+DQoNCjxwPjxzdHJvbmc+RXhhbXBsZSBleHBsYWluZWQ6PC9zdHJvbmc+PGJyPkZpcnN0IGNyZWF0ZSBhIExJIG5vZGUsPGJyPiB0aGVuIGNyZWF0ZSBhIFRleHQgbm9kZSw8YnI+IHRoZW4gYXBwZW5kIHRoZSBUZXh0IG5vZGUgdG8gdGhlIExJIG5vZGUuPGJyPkZpbmFsbHkgaW5zZXJ0IHRoZSBMSSBub2RlIGJlZm9yZSB0aGUgZmlyc3QgY2hpbGQgbm9kZSBpbiB0aGUgbGlzdC48L3A+DQoNCjxzY3JpcHQ+DQpmdW5jdGlvbiBteUZ1bmN0aW9uKCkgew0KICB2YXIgbmV3SXRlbSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoIkxJIik7DQogIHZhciB0ZXh0bm9kZSA9IGRvY3VtZW50LmNyZWF0ZVRleHROb2RlKCJXYXRlciIpOw0KICBuZXdJdGVtLmFwcGVuZENoaWxkKHRleHRub2RlKTsNCg0KICB2YXIgbGlzdCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJteUxpc3QiKTsNCiAgbGlzdC5pbnNlcnRCZWZvcmUobmV3SXRlbSwgbGlzdC5jaGlsZE5vZGVzWzBdKTsNCn0NCjwvc2NyaXB0Pg0KDQo8L2JvZHk+DQo8L2h0bWw+