zoukankan      html  css  js  c++  java
  • JQuery:模糊匹配html属性

    jQuery("[attribute |= value]")

    属性字头选择器(attribute contains prefix selector)

    如jQuery("[herflang |= 'en']")这句代码执行时将会选择文档中所有含有herflang属性,并且herflang的值以“en”开头的元素,即使"en"后面紧跟着连字符"-"也能进行选择。

    jQuery("[attribute ^= value]")

    属性开头选择器(attribute starts with selector)

    用于选择属性的值以某个字符串开头的元素,但和jQuery("[attribute] = value")的区别是,如果value的后面是一个连字符,这个元素不会被选择。例如jQuery("[rel ^= 'no']")将会选择所有rel的值以‘no’开头的元素,但类似于rel='no-***'的元素不会被选择。

    jQuery("[attribute *= value]")

    属性包含选择器(attribute contains selector)

    例如jQuery("rel *= 'no'"),表示所有带有rel属性,并且rel的值里包含子字符串“no”的元素(如rel="nofollow", rel = "yesorno"等等)都将会被选择。

    jQuery("attribute ~= value")

    属性单词选择器(attribute contains word selector)

    value的值必需是一个独立的单词或字符串,例如jQuery("rel ~= no"),此句在执行的时候会选择带有rel="yes or no"的元素,但不会选择带有rel = "yesorno" 的元素。这个选择器可以看做属性包含选择器的补充品,用于需要进行严格匹配的时候

    jQuery("[attribute $= value]")

    属性结尾选择器(attribute ends with selector)

    用于选择特定属性的值以某个字符串结尾的元素,例如jQuery("[rel $= 'no']")将会选择rel属性的值以“no”结尾的元素

    jQuery("[attribute = value]")

    属性均等选择器(attribute equals selector)

    只选择属性的值完全相等的元素,差一点都不行

    jQuery("attribute != value")

    属性非等选择器(attribute not equal selector)

    选择属性不等于某个值的元素,例如jQuery("[rel != nofollow]"),所有rel = "nofollow"的元素都不会被选择

    寻找爱
  • 相关阅读:
    [HAOI2015][bzoj 4033]树上染色(树dp+复杂度分析)
    20190716NOIP模拟赛T1 礼物(概率dp+状压)
    20190716NOIP模拟赛T2 通讯(tarjan缩点+贪心)
    延迟载入Dll(动态载入Dll)
    Dll重定向(尚存否?)
    delete和delete[] 区别
    06 序列号保护 学习分析(字符串)
    05 初识加壳脱壳
    04 复制删除行为IDA反汇编
    03 复制行为动态分析
  • 原文地址:https://www.cnblogs.com/carolina/p/5484995.html
Copyright © 2011-2022 走看看