Reputation: 3503
I've tryed construction like this:
$('div[title!=""]')
but div's with no title are also in.
Upvotes: 1
Views: 418
Reputation: 12036
$('div[title]').css('background','green'); // if has title attr
$('div[title=""]').css('background','blue'); // if has empty title or has no title attr
$('div:not([title])').css('background','red'); // if has no title attr
$('div[title]:not([title=""])').css('background','yellow'); // if has title but not empty
PS. Last one in example overwrites the first one (changes the background from green to yellow). Just try to comment out all lines except one, and see what happens. Second line overwrites one from first aswell.
Upvotes: 0