Multiple Attribute [attr="value"][attrn="valuen"] JQ 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"] Example Selectors  <<  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:

Related Tutorials

jQuery Basic Tutorials - Lesson 4 - jQuery Selectors