jquery for each all elements having similar id

后端 未结 5 1458
无人及你
无人及你 2021-02-19 16:11

I have many elements accross page - ID1, ID2 ID3 ...

I want to manipulate all the elements. Is there any simpler way to do this.

$(\"#ID\").         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-19 17:03

    If the ID portion isn't necessarily at the beginning you could do:

    $( "[tagName][id*='ID']" )
    

    Here's a full list of selectors: https://api.jquery.com/category/selectors/

提交回复
热议问题