$description = $this->t('A user-defined date format. See the <a href="http://php.net/manual/function.date.php" target="_blank">PHP </a> for available options.');
This code does not open the link in a new tab, instead it opens on the same tab. is there a way I can fix this code? Or is there an alternate to target="_blank"
or to open a URL in a new tab?
You can use jQuery :
add an ID to the ancher (here is id="myAnchor") :
$(document).on('click', 'a#myAnchor', function(e){
e.preventDefault();
var url = $(this).attr('href');
window.open(url, '_blank');
});
use this for new tab in js
<script>
window.open('http://testsite.com, "_blank");
</script>
or
<a href="javascript:void(0);" class="webMnu" onclick="window.open('http://testsite.com','plain');">Enroll</a>
Check your page source. If in source you can also see target="_blank"
then it means that action is overridden with JavaScript so you should fix JS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.