jQuery match only part of id from div

前端 未结 6 1846
星月不相逢
星月不相逢 2021-02-01 12:51

I ran into an unusual situation yesterday night.

I need to match only part of id. Let me clear you all with an example

I have few divs like



        
6条回答
  •  面向向阳花
    2021-02-01 13:28

    You could use the "Starts With" selector:

    $('div[id^="sales_info_"]')
    

    I'd rather recommend you use a unique class name for your elements that you can select on though.

提交回复
热议问题