My code is:
document.querySelector(".myTabs .line")[0].style.left = '30%' ;
I have a mistake
undefined is not an object (evaluation "document.querySelector (". myTabs.line ") [0] .style ')
How can I change css style from controller?
document.querySelectorwill return the match of the first element with the type Element. You need to convert it to HTMLElement. Try the following:
document.querySelector
Element
HTMLElement
let elm = <HTMLElement>document.querySelector(".myTabs .line"); elm.style.left = '30%'
Source: https://habr.com/ru/post/1680310/More articles:how to get element by component name in ReactJS - reactjsReorder lines in a text file for better compression - algorithmPython: any () unexpected performance - performancelooking for a quick way to calculate paired distances of many lines - pythonСортировка файла для оптимизации эффективности сжатия - sortingMoving Azure resources from a directory to another directory - azureБудет ли setState внутри компонентаWillReceiveProps запускаться перед рендерингом? - reactjsKNN in Tensorflow - Using a graph to predict invisible data - machine-learningReading environment variable in SpringBoot - javaAdding a ripple effect to a custom CompoundButton - androidAll Articles