Guest User

Untitled

a guest
Jun 23rd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. const showDropdown = () => {
  2. const structure = document.createElement("div");
  3. structure.classList.add("structure", "hide");
  4.  
  5. users.forEach(user => {
  6. const { id, name, title } = user;
  7. const option = document.createElement("div");
  8. option.addEventListener("click", () => selectOption(name));
  9. option.setAttribute("id", id);
  10.  
  11. const n = document.createElement("h5");
  12. n.textContent = name;
  13.  
  14. const t = document.createElement("p");
  15. t.textContent = `(${title})`;
  16.  
  17. option.appendChild(n);
  18. option.appendChild(t);
  19. structure.appendChild(option);
  20. });
  21. return structure;
  22. };
Add Comment
Please, Sign In to add comment