0

i want the text from my Iframe in my textarea, so i can upload the formated Text. But it dont work.I have a Database Connection and i can upload the Title from the other Textarea.

This is the Code to put the Iframetext into the Textarea.

function submit(){
var iframe = document.getElementById('editor').contentWindow.document.write('textarea');
submit.elements['textarea'].value = window.frames['editor'].document.body.innerHTML;
submit.submit();;}

This is my Html Code.

    <div id="edits" name="functions" class="col-4">
    <center>
    <input type="button" onclick="runCommand('Bold');" value="B" style="font-weight:bold;"></input>
    <input type="button" onclick="runCommand('underline');" value="U" style="text-decoration: underline;"></input>
    <input type="button" onclick="runCommand('italic');" value="K" style="font-style:italic;"></input>
    </center>
</div>

<div id="placeholder1" class="col-4 ph">_</div><div id="palceholder1" class="col-4 ph">_</div><div id="placeholder1" class="col-4 ph">_</div>

<textarea id="textarea" name="textarea" class="col-4" style="display:none;"></textarea>
<iframe name="editor" id="editor" placeholder="Hier den Text eingeben." class="col-4"></iframe>

<div id="placceholder1" class="col-4 ph">_</div>
<div id="buttons" class="col-4">
<input type="button" onclick="submit()" name="upload" value="Upload">
</div></br>

Can u help me?

  • 2
    Possible duplicate of [jQuery/JavaScript: accessing contents of an iframe](http://stackoverflow.com/questions/364952/jquery-javascript-accessing-contents-of-an-iframe) – jmargolisvt Nov 23 '16 at 14:50

1 Answers1

0

you can store whole code of iframe in a variable like var code = document.getElementById("IFRAME").innerHTML; send code as string to database

Vikas Kandari
  • 1,612
  • 18
  • 23