collaborative-text-editor
collaborative-text-editor copied to clipboard
getElementById being called on a class.
.js file
var doc = document.getElementById('doc');
.html file
<div class="doc">
<div class="doc__background-ribbon"></div>
<div class="doc__text-editor hidden"></div>
</div>
getElementById will not work on this, either use getElementsByClassName() or switch the .doc attribute to a #doc attribute.
This code will work:
(function () {
let doc = document.getElementsByClassName('doc');
doc[0].focus();
doc[0].contentEditable = true;
})()