English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery [attribute^=value] Attribute Selector

jQuery Selectors

[ attribute ^ = value Selector is used to select attributes with values that match the specifiedvalueelements that start with the specified value.

Syntax:

$("[attribute^=value]")

Example

Select each <a> element that has an href attribute value starting with "https":

$("document").ready(function(){
  $("a[href^=https]").css({"background":"green", "color":"white"});
});
Test and see‹/›

Parameter Value

ParameterDescription
attributeSpecify the name of the attribute to be selected
valueSpecify the string that should start with the specified value

jQuery Selectors