Skip to content

Instantly share code, notes, and snippets.

@jsrath
Last active October 15, 2018 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsrath/886eb6285bde9488cdfda7f2e28c8921 to your computer and use it in GitHub Desktop.
Save jsrath/886eb6285bde9488cdfda7f2e28c8921 to your computer and use it in GitHub Desktop.
for (let i = 0; i < placeLinks.length; i++) {
placeLinks[i].addEventListener('click', function (event) {
let li = document.createElement('li');
li.innerHTML = event.target.innerHTML;
selectedOptions.appendChild(li);
});
selectedOptions.style.left = `${search.getBoundingClientRect().left + 5}px`;
selectedOptions.style.top = `${search.getBoundingClientRect().bottom - 40 + this.pageYOffset}px`;
selectedOptions.style.width = `${search.getBoundingClientRect().width - 2}px`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment