Sending messages between child and parent widows with react

Issue

This Content is from Stack Overflow. Question asked by Ofer Gal

I have in the parent window the following code:

<form action='' name={'commForm'} >
 <input type='text' id='windowToClose' onChange={windowToCloseChanged} value={jobToClose} />
</form>

I also tried onChange={(e)=> windowToCloseChanged(e)}
and the method :

 const windowToCloseChanged = (e): void => { 
    console.log(e.target.value);
  };

in the child window I have the code:

opener.document.commForm.windowToClose.value = 'W' + dpcRequest.ProjJob;

When the child code runs, I can see the input field populate with the text but the on change method never gets executed.
What am I missing for the “windowToCloseChanged” to run?
Thank you



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?