Javascript QuerySelector仅返回我指定的选择器
我需要有关Javascript QuerySelector仅返回我指定的选择器,javascript,selectors-api,Javascript,Selectors Api,我需要有关querySelectorAll的帮助。有没有办法让函数返回只有我指定的元素 i、 e.document.queryselectoral('span.Fz xxs')可以返回一个元素,但我只希望它返回的元素。要选择一个,只包含您想要的类(例如:Fx xxs),而不包含其他内容,您可以使用: document.querySelectorAll('span[class="Fz-xxs"]') 为此,您可以使用:document.queryselectoral('span[class=“F
querySelectorAll
的帮助。有没有办法让函数返回只有我指定的元素
i、 e.document.queryselectoral('span.Fz xxs')
可以返回一个元素
,但我只希望它返回的元素。要选择一个
,只包含您想要的类(例如:Fx xxs),而不包含其他内容,您可以使用:
document.querySelectorAll('span[class="Fz-xxs"]')
为此,您可以使用:document.queryselectoral('span[class=“Fz xxs”]”)
Perfect!如果你把它作为答复提交,我会接受的