Answer the question
In order to leave comments, you need to log in
How to manipulate svg which is connected via object tag?
Tell me how you can manage the file connected via object svg.
It is necessary through js to change the color and position of the objects of the svg file.
The file itself is connected like this:
<object type="image/svg+xml" data="images/bnr/hotel.svg" class="backBg_item_oj bnrPolygon_in_1"></object>
<g class="..."><path id="..."/></g>
Answer the question
In order to leave comments, you need to log in
Can't access element by its id.
const
svgDocument = document.querySelector('object').contentDocument,
element = svgDocument.querySelector('здесь уже можете указывать нужный id или что там вам надо');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question