Reputation: 49
var elements = document.getElementsByClassName('active');
while(elements.length > 0){
elements[0].classList.remove('active');
}
$event.target.classList.add('active');
It shows document not defined error
Upvotes: 1
Views: 1305
Reputation: 428
you're using web technologies in a native mobile application. The best way to get the id of the element is by giving your element a ref and doing something like this:
const textField = this.$refs.groceryTextField.nativeView
There are lots of good examples in this repo: https://github.com/tralves/groceries-ns-vue/ and you can also checkout the marketplace for more code samples: market.nativescript.org.
Upvotes: 3