Computer Magic Logo
Attribute selector

Thursday, January 12, 2017

Published by Aristotelis Pitaridis

The following example demonstrates how to select all the <a> elements which have a title attribute.

var elements = $('a[title]');

We can also filter these elements by asking jQuery to give us only the elements which have a specific value. The following example finds all the <a> elements that have a title attribute equal to "Programming Languages".

var elements = $('a[title="Programming Languages"]');