Q: getElementByID in javascript [object HTMLSpanElement] I have the following problem... i want to replace a text of a div with an other text of a span.
So I tried this:
<main>
  <span id="export_text">This text should be exported</span><br>
  <div id="import_text">Here the new text should be after pressing the button</div><hr>
  <a onclick="run()"><button>run</button></a>
</main>

<script type="text/javascript">
  function run() {
    document.getElementById('import_text').innerHTML = document.getElementById('export_text');
  }
</script>

now if i press the button the text in the div gets replaced with [object HTMLSpanElement] instead of the text from the span. What did i do wrong here?
Thank you!

A: Justt add .innerHTML at the end of your export text selector:
function run() {
    document.getElementById('import_text').innerHTML = document.getElementById('export_text').innerHTML;
}

I also strongly suggest you to move your event in JS:
document.getElementById("myBtn").addEventListener("click", run);

Updated HTML:
<main> <span id="export_text">This text should be exported</span>
    <br>
    <div id="import_text">Here the new text should be after pressing the button</div>
    <hr> <a><button id="myBtn">run</button></a>
</main>

JSFiddle: http://jsfiddle.net/ghorg12110/n4cwem28/1/
