WPBakery Post grid: How to open post grid´s elements in another window (_blank)?
I created a post grid showing some PDF documents, but I need them to be open in a new window. How can I do? I found the following code, but it doesn´t work:
jQuery(window).load(function() {
jQuery('.vc_grid-item .vc_grid-item-mini').on('click', 'a', function(e){
e.preventDefault();
var url = jQuery(this).attr('href');
window.open(url, '_blank');
});
});
Solutions
you can simply do:
jQuery(document).ready(function(){
jQuery('.vc_grid-item .vc_grid-item-mini a').attr('target', '_blank');
});
This adds the target attribute with '_blank' value to the a tag.
Similar questions
Open a link in new tab, not working target='_blank'
This is a PHP code, in need to open a link in new tab. But i tried target='_blank' in all the areas not working. I think its calling the link from code_link not sure exactly.
open link with target="_blank" can´t fix it
i would like to change a link to target="_blank" (opening in a new window, or tab) but can#t fix it. i´m a fool in php and my try&error-method did´t work. can anybody help me? Thank you so much! original code from the parallax one theme (wordpress)
Open External WooCommerce Products in New Tabs - Adding Attribute target="_blank"
I have managed to add attribute target="_blank" to my external product pages but I can't seem to change the links on the parent (grouped product) pages. I was able to do this by modifying external.php and just adding the tag to the actual link itself. How can I change the links on the parent page of grouped products to add this attribute, my first ...
how to do open a link in a open window from menu bar?
I am working on a word press site. When I click on a entry in menu bar, it should open that link in a new window. I know how to do this for a button but not sure for a list item. This is the code I would use to open it in a new window for a button. I have already checked the option to open in new window/tab in the menu editor. It is now opening in ...
Pages in WordPress do not open in the same window when i click any link thar open new tab
Pages in WordPress do not open in the same window when i click any link thar open new tab
I want to upload Microsoft Office Word and PowerPoint files onto my WordPress website.View them in another window not in the same window
I want to upload Microsoft Word ,PowerPoint and also .pdf files into my WordPress website,after uploading them I want to view them in another window not in the same window. I know there are many plugins to view online but I want to view in another window of browser not on the same. Please help. Thanks in advance