jQuery: Select element where class NOT xyz

How can I select an element using find() only if the class is NOT xyz?
$('.featured>span').find('a  CLASS NOT .xyz ').click(function() { alert(123) });

Open in new window

LVL 16
hankknightAsked:
Who is Participating?
 
chaitu chaituCommented:
$('.featured > span').not('a.xyz ').click(function() { alert(123) });

0
 
chaitu chaituCommented:
$('.featured > span').not('.xyz ').click(function() { alert(123) });

0
 
leakim971PluritechnicianCommented:
Test page : http://jsfiddle.net/m8vmy/

$("a", '.featured>span').not('a.xyz ').click(function() { alert(123) });
//$('.featured>span').find("a").not('a.xyz ').click(function() { alert(123) }); // work too

Open in new window

0
 
Kiran SonawaneProject LeadCommented:
This will also work

 $('.featured > span a').not('.xyz ').click(function() { alert(123) });
0
 
Kiran SonawaneProject LeadCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.