Find all elements whose id begins with a common string

前端 未结 5 717
臣服心动
臣服心动 2020-12-01 09:01

I have a XSL that created multiple elements with the id of \"createdOn\" plus a $unique-id

Example : createdOnid0xfff5db30

I want to find a

5条回答
  •  北海茫月
    2020-12-01 09:24

    You should have just used simple CSS selector together with JavaScript's .querySelectorAll() method.

    In your case :

    var dates = document.querySelectorAll('[id^="createdOnId"]');
    

提交回复
热议问题