$('.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.
How can I do that?
Thanks in advance.
$('.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.
How can I do that?
Thanks in advance.
Share Improve this question edited Jan 3, 2017 at 20:55 Suhas Srivats Subburathinam 4251 gold badge6 silver badges19 bronze badges asked Oct 23, 2015 at 7:23 vinothvinoth 751 gold badge1 silver badge5 bronze badges 3- Do you mean browser tab? – Lucius Commented Oct 23, 2015 at 7:24
- Here's a similar thread: stackoverflow./questions/3841100/… – Thamilhan Commented Oct 23, 2015 at 7:26
- Did you open any URL or you want to open only content in new tab of browser ? Means this class "mainservice-page" contains a plete page or just content. – Manoj Srivastava Commented Oct 23, 2015 at 7:27
1 Answer
Reset to default 6You 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.