Multiple Attribute [attr="value"][attrn="valuen"]S2C Home « Selectors « Multiple Attribute [attr="value"][attrn="valuen"]
Multiple attribute match selector.
Shorthand version $('[attr="value"][attrn="valuen"]')
Description
The [attr="value"][attrn="valuen"]
selector, selects all elements that match all of the specified attribute and value filters
Syntax
Signature | Description |
---|---|
jQuery('[attr="value"][attrn="valuen"]') | Multiple Attribute match |
Parameters
Parameter | Description |
---|---|
attr | The attribute name. |
value | The optional attribute value which can be either an unquoted single word or a quoted string. |
attrn | As many more attribute names as required. |
valuen | As many more optional attribute values as required. |
Return
N/A.
Multiple Attribute [attr="value"][attrn="valuen"]
Example
Top
Selects all elements that match all of the specified attribute and value filters.
The following example will select 'a' elements with a 'href' attribute of '#multiattrb' that contain a span with a class of 'ital' and turn the background colour orange.
$(function(){
$('#btn22').on('click', function() {
$('a[href="#multiattrb"]a span[class="ital"]')
.css('backgroundColor', 'orange');
});
});