• 06 Aug

    Attribute selector using jQuery

    Hi Friends, here I’m sharing with you about selecting elements using attribute selector using jQuery.

    Attribute values in selector expressions must follow the rules for W3C CSS selectors

    Attribute Contains Prefix Selector [name|=”value”]
    Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-).

    Attribute Contains Selector [name*=”value”]
    Selects elements that have the specified attribute with a value containing a given substring.

    Attribute Contains Word Selector [name~=”value”]
    Selects elements that have the specified attribute with a value containing a given word, delimited by spaces.

    Attribute Ends With Selector [name$=”value”]
    Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive.

    Attribute Equals Selector [name=”value”]
    Selects elements that have the specified attribute with a value exactly equal to a certain value.

    Attribute Not Equal Selector [name!=”value”]
    Select elements that either don’t have the specified attribute, or do have the specified attribute but not with a certain value.

    Attribute Starts With Selector [name^=”value”]
    Selects elements that have the specified attribute with a value beginning exactly with a given string.

    Has Attribute Selector [name]
    Selects elements that have the specified attribute, with any value.

    Multiple Attribute Selector [name=”value”][name2=”value2″]
    Matches elements that match all of the specified attribute filters.

    Source: jQuery

     

    Looking for job?

    Posted by Triguns