[英]How to open the content inside a DIV tag in new tab
$('.menu div.profile-btn').on('click', function () {
$('.mainservice-page').fadeIn(1200);
}
The above script opens the contents of the div .mainservice-page
successfully, but I want to open them in a new tab. 上面的脚本成功打开了div .mainservice-page
的内容,但是我想在新选项卡中打开它们。
How can I do that? 我怎样才能做到这一点?
Thanks in advance. 提前致谢。
You can do like that : 您可以这样:
function newWindow_method_1() {
var wi = window.open();
var html = $('.mainservice-page').html();
$(wi.document.body).html(html);
}
OR
function newWindow_method_2() {
var html = $('.mainservice-page').html();
window.open(html, "__new", "width=1000,height=1000");
}
$('.menu div.profile-btn').on('click', function () {
newWindow_method_1();
// OR
// newWindow_method_2();
});
Hope this will help you. 希望这会帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.