Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function create(words) {
- let content = document.getElementById('content');
- for(let el of words) {
- let div = document.createElement('div');
- let p = document.createElement('p');
- let text = document.createTextNode(el);
- p.appendChild(text);
- p.style.display = 'none';
- div.appendChild(p);
- div.addEventListener('click', displayElement);
- content.appendChild(div);
- }
- function displayElement(e) {
- e.target.children[0].style.display = 'block';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement