Skip to content Skip to sidebar Skip to footer

How To Select Elements With Exact One Class Name?

so I have,
  • abc
  • def
If I do $('.foo').css('font-size','x-large'); this will chan

Solution 1:

You can use the following attribute selector, I suppose:

$('li[class=foo]');

Here's a JSFiddle to play with. )

Solution 2:

This should work:

$('.foo:first').css('font-size','x-large');

Post a Comment for "How To Select Elements With Exact One Class Name?"