javascript - document.querySelector multiple data-attributes in one element -
i'm trying find element document.queryselector has multiple data-attributes:
<div class="text-right" data-point-id="7febe088-4eca-493b-8455-385b39ad30e3" data-period="current">-</div>
i thought this:
document.queryselector('[data-point-id="7febe088-4eca-493b-8455-385b39ad30e3"] [data-period="current"]')
but not work. however, works well, if put second data-attribute in child-element like
<div class="text-right" data-point-id="7febe088-4eca-493b-8455-385b39ad30e3"> <span data-period="current">-</span> </div>
so, there option search both attributes @ once? i've tried several options don't it.
there should not space between 2 selectors
document.queryselector('[data-point-id="7febe088-4eca-493b-8455-385b39ad30e3"][data-period="current"]')
if give space between them become descendant selector, ie search element attribute data-period="current"
inside element data-point-id="7febe088-4eca-493b-8455-385b39ad30e3"
like
<div class="text-right" data-point-id="7febe088-4eca-493b-8455-385b39ad30e3"> <div data-period="current">-</div> </div>
Comments
Post a Comment