Can't find variable:document


I am trying to access an XML element by simply typing “document.getElementById()” method but I get an error like “Can’t find variable document”.How can I solve this problem?


document is something specific to browser, NativeScript doesn’t have a document api. But if you are interested in using apis like getElementById or class or name, you must install this plugin.


Thanks for answer.Is there any way to install the plugin on online IDE?
tns plugin add nativescript-dom
I think I suppose to write this to the command but I’m using Nativescript Playground online.


Yes, you can use the + icon besides the title Explorer in the left corner. You will be given a popup with a text field where you can enter the plugin name.


Thanks again,but I couldn’t install the plugin.It gives a TypeError.What did I do wrong?


Please read the instructions carefully, you supposed to enter just the plugin name and not the command itself.


Completely forgot it! Thank you very much again!