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
attrThe attribute name.
valueThe optional attribute value which can be either an unquoted single word or a quoted string.
attrnAs many more attribute names as required.
valuenAs many more optional attribute values as required.

Return

N/A.

Multiple Attribute [attr="value"][attrn="valuen"] Examplego to top of page 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');
  });
}); 

Press the buttons below to action the above code:


go to home page Homepage go to top of page Top