Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 548373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:04:19+00:00 2026-05-13T11:04:19+00:00

I have a parent page that contains a textarea and a link to open

  • 0

I have a parent page that contains a textarea and a link to open a child window. The child window has another textarea and a button. User enters some text in the textarea in the child window and clicks the button, a javascript gets fired that updates the content of the textarea in the parent window with that of the textarea of the child window and closed the child window.

I am currently doing this in javascript and it works fine, but since we will move to jQuery very soon how would one accomplish the same using jQuery.

page1.html
----------

<script type="text/javascript">
    function newwin() {
        window.open('page2.html','','width=600');
    }
</script>
<body> 
    <textarea id='t1'>
    <a href="javascript:void(0)" onclick="newwin();">Click here</a> 

</body>


page2.html
----------
<script type="text/javascript">
    function updateparent() {
        window.opener.document.getElementById('t1').value = document.getElementById('t2').value;
        window.close();
    }
</script>
<body> 
    <textarea id='t2'>
    <input type="submit" onclick="updateparent();"> 
</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:04:19+00:00Added an answer on May 13, 2026 at 11:04 am

    Interesting question.

    As mentioned by Domonic Roger, if its working then you probably want to be leaving it.

    For me the question is not “What is the JQuery code for this snippet?”, but how to I use jQuery to achieve the same solution.

    Sometimes it is not just a simple case of a straight code replace. Take the following:

    function updateparent() { 
        window.opener.document.getElementById('t1').value = document.getElementById('t2').value; 
        window.close(); 
    } 
    

    Now, the jQuery code might be something like this:

    function updateparent() { 
        window.opener.$("#t1").val($("#t2").val());
        window.close(); 
    } 
    

    But, I wouldn’t do this. I would use pop window functionality available in the jQuery UI, or some plugin (e.g. blockui) to acheve the popup window.

    Also, this code:

    <body>  
        <textarea id='t2'> 
        <input type="submit" onclick="updateparent();">  
    </body>
    

    In jQuery we are encouraged to use late binding of events, so any inline JavaScript would go:

    <body>  
        <textarea id='t2'> 
        <input id="MyInput" type="submit">  
    </body>
    

    And be bound once the document is ready:

    $(document).ready(function(){
        $("#MyInput").click(updateparent());
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a parent object called Page that has a List of objects called
Basically, I have a main page (parent page) with a link that opens up
I have a .jsp that contains an IFrame with a page that has some
I have a window which contains a Frame which references a 'home' page that
I have an HTML web page (the parent) that contains a hyperlink. When clicked,
I have a page (parent) that when a button (with .click funciton) is clicked
I have a page that contains a parent record and several children records. There
I have a web page that consists of a checkbox (parent) and on this
I have a page that contains a table with the following format: <table id=gigsTable>
I have the main page that contains multiple frames within the frameset. One of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.