Is there a case insensitive jQuery :contains selector?

后端 未结 12 2129
悲哀的现实
悲哀的现实 2020-11-22 02:45

Is there a case insensitive version of the :contains jQuery selector or should I do the work manually by looping over all elements and comparing their .text() to my string?<

12条回答
  •  清酒与你
    2020-11-22 03:04

    If someone (like me) is interested what do a and m[3] mean in Contains definition.


    KEY/LEGEND: Params made available by jQuery for use in the selector definitions:

    r = jQuery array of elements being scrutinised. (eg: r.length = Number of elements)

    i = index of element currently under scrutiny, within array r.

    a = element currently under scrutiny. Selector statement must return true to include it in its matched results.

    m[2] = nodeName or * that we a looking for (left of colon).

    m[3] = param passed into the :selector(param). Typically an index number, as in :nth-of-type(5), or a string, as in :color(blue).

提交回复
热议问题