I'm learning jQuery now. The following example has no effect:
- $(document).ready(function() {
- $("#cat1 ul").hide();
- $("#cat1 li:has(ul)").each(function() {
- $(this).children().slideUp(400);
- });
- $("li:has(ul)").click(function(event){
- if (this == event.target) {
- var current = this;
- $("#cat1 li:has(ul)").each(function() {
- if (this != current) $(this).children().slideUp(400);
- });
- $("ul:first", $(this)).slideToggle(400);
- }
- });
- });
If the a list contains a text (e.g. Example 2) wrapped in <a> than the text disappears. Without <a> params the code is working. How can a link excluded from hiding? Which selector is needed?