-1

I want to edit this code:

this.link = $('<a>Directions</a>').addClass('mapplic-tooltip-link').attr('href', '#').hide().appendTo(this.el);

to open in a new window. I've looked online but I don't know how to edit this. Any help would be much appreaciated.

CreativEliza
  • 271
  • 1
  • 3
  • 20

2 Answers2

0

try this

this.link = $('<a>Directions</a>')
            .addClass('mapplic-tooltip-link')
            .attr('href', '#')
            .attr('target', '_blank').hide().appendTo(this.el);

just add another property attr to your link with the target key and blank value.

BlaShadow
  • 11,075
  • 7
  • 39
  • 60
0

$(function(){
var el = $('#id');
var link = $('<a>')
            .addClass('mapplic-tooltip-link')
            .text('Directions')
            .attr({'href': '#','target': '_blank'})
            .hide()// this hide content
            .appendTo(el);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="id"></div>
alessandrio
  • 4,282
  • 2
  • 29
  • 40