Reputation: 900
My code:
document.querySelector(".myTabs .line")[0].style.left = '30%' ;
By i have error
undefined is not an object (evaluating 'document.querySelector(".myTabs .line")[0].style')
How i can change css style from controller?
Upvotes: 6
Views: 5275
Reputation: 8726
document.querySelector
will return the first element match with type is Element
. You need to convert it to HTMLElement
. Try this:
let elm = <HTMLElement>document.querySelector(".myTabs .line");
elm.style.left = '30%'
Upvotes: 7