SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jquery expand/collapse on dynamically generated list

    My script uses an Ajax GET command to pull data from an Excel spreadsheet and then display it as a series of lists and sublists. The script creates a string with the necessary HTML and then inserts it into a DIV. How can I implement an expand/collapse function for the lists? All the Jquery examples I've seen seem to work with static lists. The function would have to be placed inside the GET block.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I found the solution:

    Code:
    $("#divID").ready(function () {
                $("#divID").find('li:has(ul)').click(function (event) {
    
    (event code goes here)
    
                });
            });


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •