<div id="openModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<div id="contentindiv"></div>
</div>
</div>
I have the above div in my parent jsp file and I am using css to create a modal window effect of this div when a button is clicked.
I am loading a new jsp page in this div using
$("#contentindiv").html('<object data= <sample.jsp>');
window.location.href="#openModal";
My sample.jsp file has a text box with id tb1 and when the user enters in the modal window, I want to close the modal window and reflect it in a text box on the main jsp file whose id is tb2.
I tried accessing using document.getElementById(tb2) but that doesn't seem to work.
Any suggestions?
I either have to access the child jsp element from the parent jsp or set the parent jsp element from the child jsp.
you can do this:
$('#openModal').keydown(function(e) {
if(e.which == 13 || e.keyCode == 13) {
var text = $('#tb1').val();
$('.close').trigger('click');
$('#tb2').val(text);
}
});