Skip to content

Commit

Permalink
Fix wrong element's dynamic identifier, semicols (#1080)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomow authored Jun 17, 2021
1 parent 10b4252 commit fe9ea62
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions examples/vanilla/todo.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,40 @@ <h1>Thoughts</h1>
const form = document.getElementById('form')

const dynamicEvent = e => {
const target = e.target
const target = e.target;

gun.get(target.id).put(null)
gun.get(target.id).put(null);

target.innerHTML = document.getElementById(target.innerHTML)
target.innerHTML = document.getElementById(target.id);

if (target.innerHTML === ' null' || target.innerHTML === ' ' || target.innerHTML === '') {
target.style.display = 'none'
target.style.display = 'none';
} else {
target.style.display = 'list-item'
target.style.display = 'list-item';
}
}

gun.map().on((thought, id) => {
parentList.insertAdjacentHTML('beforeend', `<li id =${id}> ${thought}</li>`)
parentList.insertAdjacentHTML('beforeend', `<li id =${id}> ${thought}</li>`);

const links = parentList.getElementsByTagName('li')
const links = parentList.getElementsByTagName('li');

for (const link of links) {
if (link.innerHTML === ' null' || link.innerHTML === ' ' || link.innerHTML === '') {
link.style.display = 'none'
link.style.display = 'none';
} else {
link.style.display = 'list-item'
link.style.display = 'list-item';
}
link.ondblclick = dynamicEvent
link.ondblclick = dynamicEvent;
}
})

form.addEventListener('submit', e => {
e.preventDefault()
gun.set(input.value)
input.value = ''
e.preventDefault();
gun.set(input.value);
input.value = '';
})
</script>
</body>

</html>
</html>

0 comments on commit fe9ea62

Please sign in to comment.