multiple.html 705 B

12345678910111213141516171819202122232425262728
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>multiple</title>
  6. </head>
  7. <body>
  8. <!-- 1. Define some markup -->
  9. <button type="button">Select</button>
  10. <input type="text" value="Lorem ipsum">
  11. <textarea>Lorem ipsum</textarea>
  12. <!-- 2. Include library -->
  13. <script src="../dist/select.js"></script>
  14. <!-- 3. Select! -->
  15. <script>
  16. var input = document.querySelector('input');
  17. var textarea = document.querySelector('textarea');
  18. var button = document.querySelector('button');
  19. button.addEventListener('click', function(e) {
  20. console.log(select(input));
  21. console.log(select(textarea));
  22. });
  23. </script>
  24. </body>
  25. </html>