I am trying to build a tab system. If I have the following HTML:
<div class="wizard-tabs">
<ul>
<li class="active"><a href="#" data-formstep="step1">Step 1</a></li>
<li><a href="#" data-formstep="step2">Step 2</a></li>
<li><a href="#" data-formstep="step3">Step 3</a></li>
</ul>
</div>
How do I get the list item that has an anchor with a data-formstep attribute equal to a certain value? I am currently using this:
document.querySelector('.wizard-tabs > ul > li:has(a[data-formstep="'+newStep+'"])').classList.add("active")
But I am getting an error saying:
Failed to execute 'querySelector' on 'Document': '.wizard-tabs > ul > li:has(a[data-formstep="step1"])' is not a valid selector.
What am I doing wrong?