trio
trio

Reputation: 647

CasperJS querySelectorAll id start with specific string

How do I get all the DIVs starting with ID div-gpt-ad?

This is the line

document.querySelectorAll('div#div-gpt-ad-1363287890054-0-oop');

there are multiple divs with IDs starting with div-gpt-ad on my page and I want to get them all.

Upvotes: 0

Views: 931

Answers (1)

hexid
hexid

Reputation: 3811

document.querySelectorAll('div[id^=div-gpt-ad]');

This will get all div tags with an id starting with div-gpt-ad.

Upvotes: 2

Related Questions