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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:22:11+00:00 2026-05-24T23:22:11+00:00

I wrote a little pager which removes and rewrites content. I have a function

  • 0

I wrote a little pager which removes and rewrites content. I have a function called after loading the page, it shall be executed after changing the page as well. Because I do not wat to implement the function twice (on initialisation and after changing the page) I tried bind()/live() and a simple function.

The function looks like this:

jQuery('.blogentry').each(function (){
    jQuery(this).click(function(){
        //Clicking on the element opens a layer, definitely works - I tested it
    });
});

It is executed after initialisation, for executing it after page changes as well I tried the following:

jQuery('.nextPage, .prevPage').click(function changePage(){
    // Changing page and rewriting content
    showEntry();
});
//...
showEntry();
//...
function showEntry(){
jQuery('.blogentry').each(function (){
    jQuery(this).click(function(){
        //Clicking on the element opens a layer, definitely works - I tested it
    });
});
}

But the function is not executed if put inside a function (lol) and called via showEntry();

Afterwards I tried to bind the function…

jQuery('.nextPage, .prevPage').click(function changePage(){
    // Changing page and rewriting content
    jQuery('.blogentry').bind("click", showEntry);
});
//...
jQuery(this).click(function showEntry(){
    //Clicking on the element opens a layer, definitely works - I tested it
});

Did not work either. Code after the bind()-line would not execute as well.
I thought maybe it’s a problem to bind to an event function, if an event is already given via the parameter so i also tried this:

jQuery('.nextPage, .prevPage').click(function changePage(){
    // Changing page and rewriting content
    jQuery('.blogentry').bind("click", showEntry);
});
//...
function showEntry(){
    //Clicking on the element opens a layer, definitely works - I tested it
});
}

No success at all. Maybe I cannot call the function from inside the function regarding to the bind()? Maybe I just do not understand the bind()-function at all? I also tried the live() function since it seemed to fit better, as I am rewriting the content all the time. But it had the same effect: none…

  • 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-24T23:22:12+00:00Added an answer on May 24, 2026 at 11:22 pm

    The simplest way to implement this should be

    jQuery('.blogentry').live('click', function() { /* onclick handler */ }); 
    

    This should bind the function to every blogentry on the page at the moment of the call and all the blogentries that are added to the page later on.

    Additional notes:

    In $(foo).each(function() { $(this).click(fun); }); the each is unnecessary – $(foo).click(fun); is enough.

    $(foo).bind('click', fun); is functionally equivalent to $(foo).click(fun) – it does not matter which one you use.

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

Sidebar

Related Questions

I have wrote this little script which generates a nice random password. The problem
i wrote a little addin, which does some formatting of my C# code. in
i wrote a little test programm which queries the status servlet of a tomcat
I have a form which allows to view data in a page or download
hey guys, i wrote a little custom animated scroll function... function scroll(selector, animate, viewOffset)
I have a little script I wrote in python and it actually works on
I'm writing a little analysis page which will help me hunt down bugs in
I wrote little WPF application with 2 threads - main thread is GUI thread
I wrote a little daemon in Perl that calls up FFMpeg to encode a
I wrote a little search script for a client, it works and words get

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.