Skip to content

Instantly share code, notes, and snippets.

@jonathanconway
Created December 3, 2010 04:49
Show Gist options
  • Save jonathanconway/726593 to your computer and use it in GitHub Desktop.
Save jonathanconway/726593 to your computer and use it in GitHub Desktop.
jQuery CSS filter
$.extend($.expr[':'], {
/// <summary>
/// Filters on whether the element has the same css property & value as specified.
/// Example: $('a:css(color:blue)') returns only links which are blue.
/// </summary>
css: function(element, index, params) {
var style = params[3].split(':');
return element.style[style[0]] === style[1];
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment