I am trying to make this list of cd’s work. The letters will have the bands listed under them and then when each band will be clicked on a selection of albums by them will appear.
I’ve so far managed to make all of them appear when it is clicked but can’t seem to make only albums for those bands appear they all do.
And now you need to traverse the DOM properly.
The parent part takes you from the clicked A element to the LI element. The next part fails, because the LI element has no other siblings.
Instead, what would work is to not use the parent part, but my preferred solution is to use a context selector instead, where you select .header3 from within the context of the clicked link.
I put that cause target black sohuld open it but all clicking dows is close it up again. I know I can remove return false; from the javascript but this causes the page to jump back up to beginning which I don’t want it to do.
One possible solution is add on to the existing click function, so that you check if the target element is an anchor tag, and only if it’s not do you return false.
That complicates the function more than it necessarily should be though, so instead a second preferred solution is to remove the target attribute (it’s invalid anyway when using strict mode) and to instead attach a separate function on to links you want to open in a new window.
Here, we will look for all links in the header section, and those that start with “http://” we’ll attach on to them the a new window function.