Wildcards in jQuery selectors

前端 未结 6 2518
逝去的感伤
逝去的感伤 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 06:59

    When you have a more complex id string the double quotes are mandatory.

    For example if you have an id like this: id="2.2", the correct way to access it is: $('input[id="2.2"]')

    As much as possible use the double quotes, for safety reasons.

提交回复
热议问题