문제

Here the point with a exemple :

<h2>        
  <a href="/car/bmw/?load=0&value=5fs4dfsdf45"> </a>
</h2>

I want my querySelector to only select "bmw".

I used it (below), but it's only select the end of the sentence and not the value between "/car/" and "?load"

document.querySelector('h2 > a[href$=]');

Thanks for your help !

도움이 되었습니까?

해결책

try *= instead:

document.querySelector('h2>a[href*=bmw]')
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top