collaborative-text-editor icon indicating copy to clipboard operation
collaborative-text-editor copied to clipboard

getElementById being called on a class.

Open qcha0s opened this issue 6 years ago • 1 comments

.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.

qcha0s avatar Mar 09 '18 00:03 qcha0s

This code will work:

(function () {
    let doc = document.getElementsByClassName('doc');
   doc[0].focus(); 
   doc[0].contentEditable = true;
    
  })()

sarthakgupta072 avatar Mar 20 '19 17:03 sarthakgupta072