You must Sign In to post a response.
  • Category: JQuery

    Get child divs of a parent div

    How to get child divs with in a div

    expand/collapse all the divs of a div on expand/collapse click
    Thanks in advance
  • #692971
    You can easily achieve the functionality using JQuery,



    $(document).ready(function()
    {
    $("#parentdivid div).each(function()
    {
    alert($(this).html());
    })
    });



    where parentdivid : is the id of parent div

    The each function will iterate for all the div's inside the parent div and also display the inner html of the child div as alert.

    Make sure you add the JQuery reference at the top.

    Also you can find everything about JQuery on http://www.jquery.com


    Thanks & Regards


    Bunty

  • #694260

    $(document).ready(function()
    {
    $('#yourdivid' ).click(function()
    {
    $(this).children('div).toogleClass('show');
    }
    });


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.