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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:06:36+00:00 2026-05-12T10:06:36+00:00

I am trying to do something similar to the alert box that we get

  • 0

I am trying to do something similar to the alert box that we get here on SO when we get new comments and answers, the orange box that sticks to the top of the screen, I have something similar but I am trying to get an X close link on it, to close it on click

Here is what I have but it is giving me errors saying the close_error_click() is not defined?

<script type="text/javascript" >
function close_error_click(){
    $("#notify-container").fadeOut("slow", function () {
    $("#notify-container").remove();
}
</script>

<div id="notify-container">
some other code here
<a onclick="close_error_click" title="dismiss this notification">×</a>
</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-12T10:06:36+00:00Added an answer on May 12, 2026 at 10:06 am

    Rather than using an onlick attribute, you can add the following line after your function:

    $("#notify-container a").click(close_error_click);
    

    This technique known as Unobtrusive JavaScript keeps your markup clean from Javascript. Here’s a complete example:

    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title></title>
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
            <script type="text/javascript">
            $(function()
            {
                $("#notify-container a.close").click(function()
                {
                    $("#notify-container").fadeOut("slow", function()
                    {
                        $(this).remove();
                    });
                });
            });
            </script>
        </head>
        <body>
            <div id="notify-container">
                some other code here
                <a href="#" class="close" title="dismiss this notification">×</a>
            </div>
        </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find something similar in MATLAB to PyTables' table.where that selects a
I'm trying to something with JQuery similar to Red Box . I'd like to
Im trying to make something similar to twitpic.com's email submission feature. Their address schema
I'm trying to replicate something similar to the following map, where the polygonal area
I am trying to accomplish something similar to what was described in this thread:
I'm trying to achieve something similar to jQuery Glow or this fiddle . Specifically
I'm trying to implement something similar to what http://www.ancestry.com has, but I'm not sure
I'm trying to write something similar to this (sorry if the sample is not
I'm trying to build something similar to Facebook's privacy selection menu, except without the
Well,I am trying to do something similar what I did in Adobe Flex.Consuming a

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.