Home > Web Front-end > JS Tutorial > JQuery selector xpath syntax application_jquery

JQuery selector xpath syntax application_jquery

WBOY
Release: 2016-05-16 18:27:39
Original
2458 people have browsed it

For example, the following html code

Copy code The code is as follows:


    < ;li class="aaaa" title="ttt">li-1
  • li-2

  • li-2


li-1

li-2

li-2



No. A method of selecting E[@attr]
$("[@title]").click().........

that is, selecting all elements based on attributes The element with title attribute
is
  • li-1

  • li- 2

  • li-1

    li-2


    $("div[@title]").click()..........

    Select all elements with title under all div tags
    That is,
    li-1

    li-2


    The second method is to select E[@attr=val]

    $("div[@title=ttt]").click()... ...........

    Select all elements under the div whose title attribute is equal to ttt
    i.e.
    li- 1


    If it is $("[@title=ttt]").click()............

    All elements with attribute title equal to ttt
  • li-1

  • li-1


    The third method is to select E[@attr^=val] based on the starting letter of the attribute value.

    $("div[@title^=t]" ).click()............

    All attribute title values ​​under all div elements are elements starting with t


    The third method is to select E[@attr$=val] based on the starting letter of the attribute value.

    $("div[@title$=t]").click()......... .......

    All attribute title values ​​under all div elements are elements ending with t

    The third method is to select E[@attr*=val based on the attribute value containing letters. ]

    $("div[@title*=t]").click()............

    Under all div elements The value of all attributes title is all elements containing t

    The third option is to select E[@attr=val][@attr=val] based on multiple attributes

    $ ("div[@title=ttt][@class=aaaa]").click()............

    All attributes title under all div elements The value is an element
    whose value is equal to ttt and whose attribute class is equal to aaaa
    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template