jQuery selector regular expressions

前端 未结 10 2297
傲寒
傲寒 2020-11-21 22:36

I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector.

I have looked for this myself but have

10条回答
  •  醉酒成梦
    2020-11-21 23:20

    I'm just giving my real time example:

    In native javascript I used following snippet to find the elements with ids starts with "select2-qownerName_select-result".

    document.querySelectorAll("[id^='select2-qownerName_select-result']");

    When we shifted from javascript to jQuery we've replaced above snippet with the following which involves less code changes without disturbing the logic.

    $("[id^='select2-qownerName_select-result']")

提交回复
热议问题