Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6041739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:42:18+00:00 2026-05-23T06:42:18+00:00

I have da database with categories using nested sets. i have a function, that

  • 0

I have da database with categories using nested sets.

i have a function, that should list me all the categories one level beneath a certain category.

when the document loads, the starting category is “1”. this works. but when i click on a list item – to do the same with this items id as startingpoint, nothing happens. the data is passed to the document, but jquery isn’t able to apend the list items to the created ul.

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="JavaSkript/jquery-1.4.4.min.js"></script>
    <style>
        ul.kategorien{ background: #FECA40; float: left;}
    </style>
</head>
<body>
    <div id="kategorien_auflisten" style="background-color: #ffffff;">

    </div>
    <div id="error"></div>
</body>
</html>

<script type="text/javascript">
function auflisten(start) {
    $("div#kategorien_auflisten").append("<ul class='kategorien' id='" + start + "'></ul>")

    jQuery.getJSON("Datenbankabfragen/kategorien_auflisten.php", {
        startknoten: start
    }, function(data) {
        if(data != "") {
            $.each(data, function(i,data){
                $("ul#"+start).append("<li class='' id='" + data.Kategorie_Nr + "'>" + data.Name + "</li>");
            });
        }
        else {
            $("div#error").text("Die Kategorien können leider nicht aufgelistet werden.");
        }
    });
}

$(document).ready(function() {
    auflisten(1);
});

$("li").live("click", function() {
    auflisten($(this).attr("id"));
});
</script>

I hope anyone could help.
Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:42:18+00:00Added an answer on May 23, 2026 at 6:42 am

    I think I see a couple of issues.

    First, you’re taking the ID from a li element:

    $("li").live("click", function() {
        auflisten($(this).attr("id"));  // ID of the <li>
    });
    

    …passing it to auflisten:

    function auflisten(start) {
    

    …the assigning that ID to a ul element:

    .append("<ul class='kategorien' id='" + start + "'></ul>")
    

    So now it would seem that you have 2 elements with the same ID, which is invalid.

    So it seems likely that when you try to select the new ul element from the DOM using that ID, the selection will fail:

     $("ul#"+start) // Trying to select based on a non-unique ID will cause problems.
    

    Second, it seems that you’re using numeric IDs. This is not valid in HTML4, and can cause similar selection problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database that contains a date and we are using the MaskedEditExtender
I have an existing database that contains 4 tables: categories, sub-categories, products, prices. I
I have the following information that should be retrieved by using several dependent select
I have a Database with a category table using the Nested Approach in MySql.
I have list box(lstcategories) .. filled with items coming from database by using the
I have a product database with several product categories. Each category has a number
Currently I have database with the following associations: One Client to Many Intakes One
I have a database table and one of the fields (not the primary key)
i am trying to load images from the northwind database (categories table, images that
Let's assume I have a database with two tables: categories and articles . Every

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.