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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:23:25+00:00 2026-06-03T02:23:25+00:00

This must be simpler than I’m making it out to be. Not sure what’s

  • 0

This must be simpler than I’m making it out to be. Not sure what’s going on.

I have a DIV that I’m “filling” with a Handlebar template. Once the template is generated, I use a jQuery slideDown to open the panel to view the contents. Now I need to put a close function to slideUp the DIV.

I think the problem is the click function isn’t getting bound because the a.close element is within a script tag.

Here’s the DIV for the content:

<div id="characteristic" style="bottom:0px; width:800px; display:none; position:fixed; left: 350px;"></div>

Here’s the jQuery snippet. This is at the top of the HTML:

$(document).ready(function(e){
  $("a.close").click(function(e) {
     e.preventDefault();
     $("#characteristic").slideUp();
  });
});

And a snippet of the template:

<script id="ac-template" type="text/x-handlebars-template">
    <div class="holder" style="background-color:#FFFFFF;">
        <div class="frame">
            <div class="content">
                <div class="info-box-holder">
                    <a class="close" href="">&times;</a>
                    <div class="heading">
                        <h2>ACTIONABLE CHARACTERISTIC</h2>
                    </div>
                    <div class="info-box">
                        <a href="#"><img class="alignleft" src="{{image_large}}" alt="" width="400" height="400" /></a>
                        {{#if subcategory_name}}
                            <h2>{{subcategory_name}}: {{name}}</h2>
                        {{else}}
                            <h2>{{category_name}}: {{name}}</h2>
                        {{/if}}
  • 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-06-03T02:23:27+00:00Added an answer on June 3, 2026 at 2:23 am

    I know this is an old question and you’ve probably already worked out the answer, but yes, it’s because at the time that your JS code runs, a.close does not exist in the DOM.

    You need to either run the JS code after handlebars has finished rendering the template, or bind to a higher level DOM element that exists on page load (a container of some sort) and then activate only for the link that you want. Something like this (see the API):

    $(document).ready(function(e){
      $("#mycontainerdiv").on('click', 'div.info-box-holder a.close', function(e) {
         e.preventDefault();
         $("#characteristic").slideUp();
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This must be simple, but I can't seem to figure it out. I am
This must be quite simple but I can't seem to figure this out. I've
I must be going insane. This is incredibly simple so I am apparently overlooking
I have multiple classes that are not allowed to modify each other's fields, but
This must be simple, yet I can't seem to find an answer. I have
This might be extremely simple: I have a controller that returns a user object
This has bothered me for awhile. The way I've been renaming columns that have
I'm having some trouble figuring out the right way to do this: I have
I have a problem that I think is caused by the wm_keyup message not
This must be very simple, but I couldn't find it on the documentation. 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.