-1

I am a newbie in to the nativescript framework I wanna tryout some stuffs then I stumbled upon the this plugin now I dont know how to use it with typescript

TypeError: page.getElementById is not a function

enter image description here Here is error I get. Attached is my code screen shot

Muhammed
  • 21
  • 6
  • So you used page.getViewById, and all of a sudden you started using `getElementById`? Is that a clue enough? – pkanev Aug 28 '17 at 18:53
  • Also, note that you have several views with the same id, this will be a problem when trying to find the right view. – pkanev Aug 29 '17 at 08:47
  • Yes! this is where I've got problem because I need to to use multiple items with the same ID, that lead me in to the use of nativescript-dom plugin – Muhammed Aug 30 '17 at 15:41
  • I believe having different views with the same id is wrong. Consider using a common 'class' instead. – pkanev Aug 30 '17 at 15:43
  • using the same class how do I select them together and change hidden class on all of the items – Muhammed Aug 30 '17 at 19:32

1 Answers1

0

The method you are looking for on a View instance is getViewById which allows you to get a child view by its id.

https://docs.nativescript.org/ui/basics#execute-business-logic

pkanev
  • 1,486
  • 1
  • 12
  • 20