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

  • SEARCH
  • Home
  • 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 5976495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:14:13+00:00 2026-05-22T21:14:13+00:00

let me start by qualifying that I am very new to jquery. I’ve been

  • 0

let me start by qualifying that I am very new to jquery. I’ve been using it for a month or so now with moderate success. I’m hoping my question is easily answered.

Basically, I have a dialog on a page that contains content that is generated within a DWR Ajax call. What I want to do is define a couple of divs in my content such that when a header div is clicked, the second div tag referenced by the first needs to be hidden / shown via the jquery slideToggle function on the referenced div. Try though I might however, I am unable to get this method to be called.

Here is the javascript method I am calling, please note that for testing purposes I have omitted the dwr ajax call and am manually setting the html in the showdialog method.

The dialog opens fine and displays my content as expected. However clicking the div containing the expansion-header class does not toggle the view of the referenced ‘ELEMENT_ONE’ div.

Any thoughts or comments would be most appreciated. I am sure I am doing something silly, but for the life of me I can’t work it out.

Javascript

function showdialog() {

var data = '<DIV class="expansion-header" reference="ELEMENT_ONE">'
        + '<B>Click to Toggle Element One<B></DIV>' 
        + '<DIV id="ELEMENT_ONE" name="ELEMENT_ONE">'
        + 'This is element ones text it contains a<BR>few lines of gibberish.<BR><BR>'
        + 'This is the second paragraph to be hidden when the header is clicked</DIV>';

  $("#StatusDialog").html(data);
  $("#StatusDialog").dialog("open");   
}

$(document).ready(function() {

  $(".expansion-header").click(function () {
    var reference = $(this).attr('reference');
    $("#" + reference).slideToggle(400);
  });

  $("body").append('<div id="StatusDialog" title="Dialog Title"></div>');
  $("#StatusDialog").dialog({  
    autoOpen: false,    
    resizable: true,
    width: 750,
    modal: false           
  });    
});

HTML

<div id="status" class="status" style="cursor: pointer; cursor: hand;" onclick="showdialog()">Click Me</div>
  • 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-22T21:14:14+00:00Added an answer on May 22, 2026 at 9:14 pm

    You have defined the click event for .expansion-header before it exists!

    should attach the click event in showdialog()

    or consider binding it using .live()

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

Sidebar

Related Questions

Let me start by pointing out that while I've been using Java SE for
Let me start by saying that I'm not a power-JavaScript/jQuery programmer, I do very
Let me start by saying I'm very new to Java and to this site.
Let me start out by saying that I am new to Java/JSP web development,
Let me start by saying that I have been reading the drag'n drop tutorial
let me start with that i am pretty new to c# currently i have
Let me start off by saying I'm brand new to Android programming. I'm using
Let me start by saying, I like the border that chrome is using for
Let me start by saying that I'm not a JavaScript programer or a jQuery
Let me start by telling you that I never used anything besides SVN and

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.