-2

I have this JS in my website to display a custom text message, and the message has a hyperlink. However, it opens it in the current window and I want to make sure it opens in a new tab. I cannot figure out how to achieve that in these circumstances.

var conceptName = jQuery('#pa_analise_objeto').find(":selected").val();
if(conceptName=='sem_revisao') {
    jQuery("#displayCustomMsg").html("<p>The model will be <br/>printed automatically <a href='https://LINK.HERE.COM' style='color: #202020;'><u>verificação manual</u></a></p>");
}
pmcoltrane
  • 3,052
  • 1
  • 24
  • 30
Jaime Matos
  • 343
  • 1
  • 14

2 Answers2

4

Use target='_blank' attribute to <a> tag.

var conceptName = jQuery('#pa_analise_objeto').find(":selected").val();
  if(conceptName=='sem_revisao'){
     jQuery("#displayCustomMsg").html("<p>The model will be <br/>printed automatically <a target='_blank' href='https://LINK.HERE.COM' style='color: #202020;'><u>verificação manual</u></a></p>");
     }
Himanshu Upadhyay
  • 6,558
  • 1
  • 20
  • 33
1

Add target="_blank" to your anchor tag, it'll open a new tab.

<a target="_blank" href='https://LINK.HERE.COM' style='color: #202020;'><u>verificação manual</u></a>
connoraworden
  • 581
  • 3
  • 12