Reputation: 21162
here is the jsfiddle that I tried to do this: http://jsfiddle.net/fxMFh/
I want to add two li's into the end of the submenu with jquery, but this seems that doesnt navigate to the ul it needs to:
$(document).ready(function() {
$(".navigation_container nav > ul > li > ul").append('<li><a href="#">test</a></li>');
});
this must be the problem:
$(".navigation_container nav > ul > li > ul")
I must be doing something very noobish here..
Upvotes: 1
Views: 370
Reputation: 2011
Three problems:
The fiddle doesn't include jQuery.
The selector is missing a div wrapper. It should be:
$(".navigation_container nav > ul > li > div > ul")
.appendTo()
should be .append()
http://jsfiddle.net/ryanbrill/fxMFh/5/
Upvotes: 1
Reputation: 388326
Try
$(document).ready(function() {
$(".navigation_container nav > ul > li > div.sub-menu > ul").append('<li><a href="#">test</a></li>');
});
Demo: Fiddle
But probably I will shorten the selector to
$(document).ready(function() {
$(".navigation_container nav div.sub-menu > ul").append('<li><a href="#">test</a></li>');
});
Demo: Fiddle
Upvotes: 1