Is it possible to Copy data from a <input> box the the main windows (the input is opened in a pop-up). I've seen date-time pickers can do that, but can't find the function!

I found this solution:
Im openin a with a pop-up my crop.php
and then use this button to copy values to main window

<button onclick="javascript:window.opener.document.getElementById('pic').value='value1'; window.close();">Finish &amp; Close</button>

pic is a input box <input name="article_pic" type="text" id="article_pic" />

value1 is the new value i want to copy from this window!
Click, Copy & Close ;)

OK now I need a little help.

I want to add content to a <textarea>

tried with: document.getElementById('text').value='SOMETHING';
but didn't work

[edit] getElementById('text').innerHTML=''; Works, but if I edit the inserted text, or delet it, then it doesn't work anymore

I nned to check If textarea has something written in it, then just add it to the end of textarea, not replace the whole content! ELSE, just add it


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.