Answer the question
In order to leave comments, you need to log in
How to pass text to textarea in iframe?
How can I pass text from a div (#test) to a textarea (#message) that is in an iframe window on click.<div id="test">Передано в textarea iframe</div>
Answer the question
In order to leave comments, you need to log in
You need to get the DOM object of the iframe document, select the desired element in it and set its value.
var text = this.innerHTML;
var iframe = document.getElementById('iframe1');
var textarea = iframe.document.getElementById('textarea1');
textarea.value += text;
<div id="test" onclick="document.getElementById('iframe1').document.getElementById('textarea1').value +=this.innerHTML">Передано в textarea iframe</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question