click on a link and display in a textarea an html code

0

How would I do when I click on a particular link for example <a href='javascript:void(0)'>Capitulo</a> displayed on a textarea the <strong></strong> tags, among other link's that I will have to display different tags

document.addEventListener("DOMContentLoaded", function() {
  var els = document.body.querySelectorAll("a[href*='java']");
  for (var x = 0; x < els.length; x++) {
    els[x].addEventListener("click", function() {
      var a_txt = this.textContent,
        inpt = document.body.querySelector("#versiculos");
      inpt.value += " " + a_txt;
    });
  }
});
<ul>
  <li><a href="javascript:void(0)">Capitulo</a></li>
  <li><a href="javascript:void(0)">Versículo</a></li>
  <li><a href="javascript:void(0)">Destaque</a></li>
  <li><a href="javascript:void(0)">Link's</a></li>
  <li><a href="javascript:void(0)">Quebra de linhas</a></li>
</ul>
    
asked by anonymous 14.06.2018 / 17:33

0 answers