Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function create(words) {
- const mainDiv = document.getElementById('content');
- words.forEach((word) => {
- const divElement = document.createElement('div');
- const pElement = document.createElement('p');
- pElement.style.display = 'none';
- pElement.textContent = word;
- divElement.appendChild(pElement);
- divElement.addEventListener('click', (e) => {
- const targetPElement = e.target.firstChild;
- targetPElement.style.display = 'block';
- });
- mainDiv.appendChild(divElement);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement