Reputation: 2526
I have following div with a textbox in it.
<div id="DvPrint">
<div>
<input type="text" style="width: 100px;
margin-left: 25px;" class="textbox" id="ctl00_content_TxtLetterNumber" readonly="readonly" name="ctl00$content$TxtLetterNumber">
</div>
</div>
Now I write the div contents in a new window using window.open.
n = window.open('M80Print.aspx', '_blank', 'status=no,toolbar=no,menubar=yes,height=550px,width=640px');
n.document.open();
n.document.write($('#DvPrint').html());
Now I want to change the textbox value in new opened window. How can I do it?? Something like this:
n.document.getElementById('ctl00_content_TxtLetterNumber').innerHTML = "1";
but it doesn't work.
Upvotes: 0
Views: 4334
Reputation: 150283
n.document.getElementById('ctl00_content_TxtLetterNumber').value = "1";
Changing textbox value is being done with value
, not with innerHTML
.
jQuery:
$('#ctl00_content_TxtLetterNumber', n.document).val('1');
Upvotes: 3