a simple example of an attribute selector

  1. i have the class item1
  2. i have the class item2
  3. i have the class item3
  4. i have the class irrelevant
  5. i have no class!

the selector looks like this:

    $('li[@class^=item]').css('backgroundColor','yellow');

Simplifying:

    $('li').css('listStyleType','square');

Select all <li> elements (and make their dot square)

    $('li[@class]').css('fontSize','200%');

Select all <li> elements that have any class at all (and make their font bigger)

    $('li[@class^=item]').css('backgroundColor','yellow');

Select all <li> elements that have a class which begins with the pattern item (and give them a yellow background)