Selecting element which starts with “abc” and ends with “xyz”

前端 未结 3 1013
误落风尘
误落风尘 2021-01-23 00:21

I have elements in my page with ids like \"abc_1_2_3_xyz\" .How do I select element in Jquery which starts with \"abc\" and ends with \"xyz\"?

$(\'div[id^=\"abc         


        
3条回答
  •  鱼传尺愫
    2021-01-23 01:03

    Try the following:

    $('div[id^="abc"][id$="xyz"]');
    

    http://api.jquery.com/multiple-attribute-selector/

提交回复
热议问题