This is a bug in jQuery .
You have two options:
- Get rid of
:and using "non-standard" attributes (to be honest, this is not a big deal). - Get more details or use the plugin to get functionality anyway:
Initially, you may need the following:
$('div').filter(function() {
return $(this).attr('user:name') !== undefined;
}).whateverElse();
, jQuery [], , . , , , , jQuery - :
$.fn.hasattr = function(attr) {
return this.filter(function() {
return $(this).attr(attr) !== undefined;
});
};
:
$('div').hasattr('user:name').whateverElse();
, , -, :
$.fn.cmpattr = function(attr, value) {
return this.filter(function() {
return $(this).attr(attr) == value;
});
};
:
$('div').cmpattr('user:name', 'Ropstah').whateverElse();