-4

I want to access all tags with id="BasketProduct..."

HTML

<ul class ="productdetails">
    <li id="BasketProduct-60">...</li>
    <li id="BasketProduct-133">...</li>
    <li id="BasketProduct-195">...</li>
    <li id="BasketProduct-202">...</li>
</ul>
donkripton
  • 59
  • 1
  • 9
  • 2
    `document.querySelectorAll('[id^="BasketProduct"]')` – pawel Sep 15 '15 at 10:11
  • here is similar qoustion with answer : http://stackoverflow.com/questions/4275071/javascript-getelementbyid-wildcard – Shirin Abdolahi Sep 15 '15 at 10:11
  • if i use .getElementById('BasketProduct') i receive – donkripton Sep 15 '15 at 10:12
  • TypeError: ul.getElementById is not a function(…) – donkripton Sep 15 '15 at 10:12
  • 1
    Why not just set them all to have the class `BasketProduct` as well as a specific `id`? – SuperBiasedMan Sep 15 '15 at 11:26