si la recherche est très spécifique, vous pouvez créer un nouveau sélecteur:
(function($) {
$.fn.tagName = function() {
return this.get(0).tagName.toLowerCase();
}
$.expr[':'].inHRef = function(obj, index, meta, stack){
if ($(obj).tagName() != 'a')
return false;
var afi = $(obj).attr('href').split('?'), sfi, txt = meta[3];
if (afi.length == 1)
return false;
sfi = afi[1];
// Regular Expression
var rgCI = '\\'+sfi+'\\gi';
// case-insensitive
return (rgCI.match(txt));
var rgCS = '\\'+sfi+'\\g';
// case-sensitive
//return (rgCS.match(txt));
// IndexOf
// case-insensitive
//return (sfi.toLowerCase().indexOf(txt.toLowerCase()) > -1);
// case-sensitive
//return (sfi.indexOf(txt) > -1);
};
})(jQuery);
$(function() {
$('a:inHRef(iframe)').css('background-color', '#aaaaa0');
});
example
example update
example end update
Gardez à l'esprit ce trouverait aussi * partout * dans le lien , par exemple 'www.iframe.com' serait également correspondre :) –