How can I select an element by ID with jQuery using regex?

前端 未结 7 1692
执念已碎
执念已碎 2020-11-28 05:51

I have the following input elements:




        
7条回答
  •  迷失自我
    2020-11-28 06:49

    This can be done like so:

    $('input').filter(function(){ return this.id.match(/^AAA_.+_BBB$/) })
    

    You can give use $('input', ) to make the search more precise. See also here

提交回复
热议问题