Wildcards in jQuery selectors

前端 未结 6 2328
逝去的感伤
逝去的感伤 2020-11-22 06:18

I\'m trying to use a wildcard to get the id of all the elements whose id begin with \"jander\". I tried $(\'#jander*\'), $(\'#jander%\') but it doe

6条回答
  •  旧巷少年郎
    2020-11-22 07:00

    Since the title suggests wildcard you could also use this:

    $(document).ready(function(){
      console.log($('[id*=ander]'));
    });
    
    

    This will select the given string anywhere in the id.

提交回复
热议问题