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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:23:34+00:00 2026-05-24T05:23:34+00:00

This is my first code: $j(‘.toggle’).delegate(”,’click’,function(e){ e.preventDefault(); }); This is stopping my a-tag from

  • 0

This is my first code:

$j('.toggle').delegate('','click',function(e){
    e.preventDefault();
});

This is stopping my a-tag from doing anything.

Now I want this in a function like this:

$j('.toggle').delegate('','click',function(e){
    banner();
});

if(x)
{
banner();
}

function banner() 
{ 
e.preventDefault(); 
}

But I can’t use the event now, how can I solve this?

EDIT

Thanks for the response, but I solved my problem another way.
This is the code if you are interested.
When you hide a banner, the banner will stay hidden on all pages, checking a cookie.
When you open it again, it will stay open on all pages.

    // Set cookie if there is no cookie
    if(getCookie() != 0 && getCookie() != 1)
    {
        setCookie(1);
    }

    // Close the banner if cookie = 0 when page loads
    if(getCookie() == '0')
    {
        closeBanner();
    }

    // Set the cookie   
    function setCookie(status) {
        $j.cookie('status', status, { path: '/', expires: 100 });
        return false;
    }

    // Get the cookie
    function getCookie() {
        //console.log($j.cookie('status'));
        return $j.cookie('status');
    }

    // Close and open the banner on click

    $j('.toggle').delegate('','click',function(e){
        e.preventDefault();

        if(getCookie() == 1)
        {
            setCookie(0);
            closeBanner();
        } else if(getCookie() == 0)
        {
            setCookie(1);
            openBanner();
        }
    });

    // Close the banner
    function closeBanner()
    {
        var src = $j('#img_lipke').attr("src").replace("lipske", "lipske_down");
        $j('#img_lipke').attr("src", src);
        $j('#bannerbottom').css('margin-top','5px');

        changeBanner();
    }

    // Open the banner
    function openBanner()
    {
        var src = $j('#img_lipke').attr("src").replace("lipske_down", "lipske");
        $j('#img_lipke').attr("src", src);
        $j('#bannerbottom').css('margin-top','0');

        changeBanner();
    }

    // Open or close the banner
    function changeBanner(e) 
    {
        $j('#banner').animate({ 
            height: 'toggle'
        }, 800, function() {
            // Animation complete.
        });
    }
  • 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-24T05:23:35+00:00Added an answer on May 24, 2026 at 5:23 am

    Just add the preventDefault after your call to banner

    $j('.toggle').delegate('','click',function(e){
        banner();
        e.preventDefault();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code first: '''this is main structure of my program''' from twisted.web import http from
This code snippet is from C# in Depth static bool AreReferencesEqual<T>(T first, T second)
I have this code i am doing for university. The first code works as
Saw this piece of code in a Ruby on Rails book. This first one
This is my first question on stackoverflow. I just wonder why my getJSON code
Firstly sorry for the long piece of code pasted below. This is my first
First check out this code. I seems like it should work for me, but
I have this code: tableList = [[NSMutableArray alloc] initWithObjects:@First View,@Second View,nil]; I have synthesized
when I run this code for the first time <?php session_start(); echo SID; ?>
Can anyone explain why this code with the given routes returns the first route?

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.