How to add link along with alert

Asked

Viewed 31 times

-1

It is possible to add a link along with the alert (Copied text? yes), and make it possible to click and go to this new page if the user wishes?

Obs.: the link should appear only in yes.

Can someone help me?

var copyTextareaBtn = document.querySelector('.copiar');

copyTextareaBtn.addEventListener('click', function(event) {
  var copyTextarea = document.querySelector('.textarea');
  copyTextarea.select();

  try {
    var successful = document.execCommand('copy');
    var msg = successful ? 'sim!' : 'não!';
    alert('Texto copiado? ' + msg);
  } catch (err) {
    alert('Opa, Não conseguimos copiar o texto, é possivel que o seu navegador não tenha suporte, tente usar Crtl+C.');
  }
});
<textarea class="textarea">Vamos copiar este texto?</textarea>
<br>
<button class="copiar">Copiar Texto</button>

1 answer

0

Cannot include a link in Alert, it accepts text only.

An alternative would be the use of Jquery Dialog

  • But as I add in my code?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.