0

http://readysalteddev.co.uk/hr/

I'm working on a website with a tray, which hides children menu items under the main item.

I have a .click(function()) which is not recognising the div being clicked. I've tried z-index changes but to no avail. I changed the div to a different div in the tray which worked, so I don't know what's gone wrong.

 <li class="menu-item-has-children">

is the click and I'm trying to get the sub-menu in it's parent folder to toggle.

$(document).ready(function()
{

    $(".menu-child-arrow").click(function(){

        $(this).parent('.menu-item-has-children').toggle();

        $(this).toggle();

        $(this).parent('.menu-item-has-children').find('>.sub-menu').toggle();

    });

});

I've put multiple things in there just as tests, to see if I had incorrectly written the code.

EDIT

For my own sanity when returning to this question, the answer was finally found in a long stream of comments which has been removed so, the accepted answer below was not what fixed this issue, but the guy who gave it did give the right answer. So, what 'fixed' this was:

I had to remove the above code from the gathered source and insert it into the footer separately to allow it to work

If I ever recode it or figure out how what was the deal, I'll return. Otherwise hopefully this helps anyone else.

2
  • 1
    Fix ur website - all resources are pointing to localhost :) Commented May 1, 2015 at 15:16
  • Sorry sorry sorry, I've been stressing over this for two hours, a little out of my head! Fixed now. Commented May 1, 2015 at 15:18

1 Answer 1

1

http://jsfiddle.net/Benjih/n1pgoa3m/

You are using .find() instead of the .children()

I hope this is what you're after! :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.