To ensure a link behaves as intended, you can attach an event listener that utilizes event.stopPropagation()
and event.preventDefault()
Using jQuery to target all links within labels:
$(document).on("tap click", 'label a', function( event, data ){
event.stopPropagation();
event.preventDefault();
window.open($(this).attr('href'), $(this).attr('target'));
return false;
});
Alternatively, with pure JavaScript (assign an id to the specific link):
var termLink = document.getElementById('termLink');
var termClickHandler = function(event) {
event.stopPropagation();
event.preventDefault();
window.open(termLink.href, termLink.target);
return false;
};
termLink.addEventListener('click', termClickHandler);
termLink.addEventListener('touchstart', termClickHandler);
Ensure the link's target is either set to _self
or _blank
for opening in the same window or a new window respectively.