How to get the parent html element of a child

advertisements

I have created a child.jsp file which has a button named Continue. I have created a jsp page named login.jsp which has name and password input text. and in that jsp file i have included child.jsp file using following code. I have created onclick listener in child.jsp file. I want to access the value of input field (name and password). How can i achieve this?

<jsp:include page="child.jsp" flush="true">
                <jsp:param name="BtnName" value="Continue"/>
                <jsp:param name="BtnContinue" value="Get Weather1"/>
            </jsp:include>


I found the solution, using window.parent.document we can get the document of the parent. Use the following code to get any element of parent using its id.

window.parent.document.getElementById("elementId");