js document.appendChild not working

06-19-2018 09:59 AM
New Contributor II

When I run my app in mobile, I don't want to have my custom widget visible, so I went into the panel.js its tied to and changed this.domNode's style="display: none", and this worked. Now, in my custom widget's widget.js file, I'm trying to create a separate panel that displays some of the information that the custom widget displays when ran on desktop. I'm trying to create it through dynamic javascript (document.createElement('div')), but when I try document.appendChild(mobilepanel), chromes developer tools throws the error that the document can only have 1 element attached to it. Is there any way I can do something like this? I would add more html to the custom widgets widget.html file and just turn its display off an on with flags, but since I changed the this.domNode display to none, i think this will override whatever dynamic html changes in the custom widgets widget.js file. 

0 Kudos
0 Replies