So, I have a rich text editor, that lets me write html into a div.
<div id="editor" contenteditable="true">
@Html.Raw(Model.Text)
</div>
</div>
<div class="tab-pane" id="source">
<div class="textarea" id="editSource" contenteditable="true">
@Model.Text
</div>
</div>
I have a bootstrav nav-tabs that separate these two modes, I wanted to use javascript to set the content of the other editor div when swapping modes. here are the tabs and the javascript I'm writing.
function editorClick() {
$('#editor').innerHTML = $('#editSource').innerHTML;
};
function sourceClick() {
$('#editSource').innerHTML = $('#editor').html();
};
</script>
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link active" href="#edit" data-toggle="tab" onclick="editorClick();">Editor</a></li>
<li class="nav-item"><a class="nav-link" href="#source" data-toggle="tab" onclick="sourceClick();">Source</a></li>
</ul>
I'm not concerned about the logic yet as I haven't been able to test it. the javascript functions don't change the content of the other editors. so something is wrong.