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 7494733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:44:33+00:00 2026-05-29T17:44:33+00:00

I created a widget framework using inettuts and added some database functionality with ajax

  • 0

I created a widget framework using inettuts and added some database functionality with ajax in asp.net and sqlserver. Widgets are loaded according to the database data of the user but i got a problem.When i move a widget the javascript inside it doesnt work. here are my codes what do you think the problem is.

<script language="javascript" type="text/javascript">
jQuery(document).ready(function () {
        jQuery(".c").hide();
jQuery("#widgetbodycontainer").click(function(e) {
    console.log("clicked");
    // if user clicks on a .c element or a descendant of one
    if (jQuery(e.target).hasClass("h") || jQuery(e.target).parents(".h").length) {
        jQuery(e.target).next(".c").slideToggle(200);
    }
});​
});

</script>
<div id="container">

<div id="widgetbodycontainer" >

<div class="layer1">

<p class="h">Company </p>
<div class="c">
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></div>
<p class="h">Person</p>
<div class="c">
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></div>
<p class="h">Result</p>
<div class="c"></div>
</div>

</div>
</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-29T17:44:36+00:00Added an answer on May 29, 2026 at 5:44 pm

    Presumably because your ajax behaviour is replacing elements, destroying any event handlers which are directly tied to them. You will need to use event delegation, which, in essence, means tying a “smart” handler to a suitable parent container. Try:

    // as of jQuery 1.7
    jQuery("#widgetbodycontainer").on("click", ".h", function () {
        jQuery(this).next(".c").slideToggle(200);
    });
    
    • http://api.jquery.com/on/

    EDIT: Since you are using a prehistoric release of jQuery, you’ll have to do event delegation the old-school way:

    jQuery("#widgetbodycontainer").click(function(e) {
        console.log("clicked");
        // if user clicks on a .c element or a descendant of one
        if (jQuery(e.target).hasClass("h") || jQuery(e.target).parents(".h").length) {
            jQuery(e.target).next(".c").slideToggle(200);
        }
    });​
    

    Demo.

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

Sidebar

Related Questions

Here is my dilemma, I am working on some SaaS using ASP.net MVC3 and
I am using Jidesoft's Dashboard framework to create a dashboard and some widgets. The
Actually I created a button using the cobogw widget library. But the button does
I created some widgets with jQuery UI and I notice that buttons have a
I'm writing a webapp using Zend framework and a homebrew widget system. Every widget
If I create a Composite Widget using UIBinder, then use my created widget in
I created a composite widget with webkit_webview widget stored in scrollwed window with a
I have created an App Widget for Android 1.5. It uses a TextView to
I've created a Vista sidebar widget that uses jQuery to fetch XML and display
I have created custom jQuery UI widget called uiPopover, very similar to UI-dialog (in

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.