1

I have a requirement where if I click a button a function is called which will 1. Open a given html link in new tab 2. And access the newly opened html's DOM

I am trying something like this in my function call:

function GenerateReport() {
window.open('./qunit/EditOpenSave.html','_blank');
//////window.location.href = "./qunit/EditOpenSave.html";
document.getElementById("inputTextToSave").value = "Show me !!!";
}

But here it successfully opens the link, while not accessing it's DOM. Please help..

Om Sao
  • 7,064
  • 2
  • 47
  • 61
  • 2
    Please try searching: http://stackoverflow.com/questions/1258563/how-can-i-access-the-dom-tree-of-child-window – RichieAHB Sep 23 '14 at 10:45

1 Answers1

3

I tried this way and it's working !!!

function GenerateReport() {
newTab = window.open('./qunit/EditOpenSave.html','_blank');
$(newTab.document).ready(function () {
$(newTab.document).contents().find('#inputTextToSave').html("asdfasdf");
});
}
Om Sao
  • 7,064
  • 2
  • 47
  • 61