troubleshooting Question

How to capture which CLASS is clicked in jquery?

Avatar of FairyBusiness
FairyBusinessFlag for United States of America asked on
JavaScript
34 Comments2 Solutions243 ViewsLast Modified:
Hi, for my nav menu I want all of the regular men links (not any from the drop down menus) to default to their first child link.  So when you click on 'about us' it goes to 'kitchen master'

but because its classes its needs not to default to the first one everytime but to which class was clicked so that it knows to go to the next link after that one, not 'kitchen master' everytime.

$('.parent').click(function () {
    var li =  $('li').next();
    var target_url = $('.ul_1 > ' + li + ':eq(0) > a').attr('href');
	alert(target_url);
    if(target_url!=undefined) window.location.href=target_url;
    return false;
});

Any ideas?

http://gowiththemaster.com/tleithoff/index.php
ASKER CERTIFIED SOLUTION
HainKurt
Sr. System Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 34 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 34 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros