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

  • Home
  • SEARCH
  • 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 6774593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:48:21+00:00 2026-05-26T15:48:21+00:00

This is a repeating issue for me and I have a solution but it

  • 0

This is a repeating issue for me and I have a solution but it is a little messy and i’m wondering if there is a better solution or someway to avoid the problem alltogether.

This issue occurs when I bind from jQuery to a DOM component and then re-render that component using JSF/AJAX.

For example:

<h:commandButton>
  <f:ajax render="rerenderedObject" />
</h:commandButton>

<h:panelGroup id="rerenderedObject">
  ...
</h:panelGroup>

And on the jQuery side:

var componentBound = false;
function bindToClick() {
   if (componentBound === false) {
      componentBound = true;
      $('#rerenderedObject').click(function() { 
        // DO SOMETHING 
      });
   }

}

The binding to click is lost whenever the rerenderedObject gets re-rendered (the button is pushed)

I have managed to overcome this by binding to JSF using this code:

$(window).load(function () {
    jsf.ajax.addOnEvent(function(data){
        if (data.status === "success") {
            bindToClick();
        }
    });
});

And yet there exists the problem of multiple event bindings (since not every ajax event re-renders rerenderedObject) hence the componentBound` variable.

This is my solution, I was wondering if anyone had to deal with this and what was your solution.

Thanks!

  • 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-26T15:48:21+00:00Added an answer on May 26, 2026 at 3:48 pm

    Use jQuery.live() instead. It’ll put a monitor on newly added elements and reapply the same event handler.

    $('#rerenderedObject').live('click', function() { 
        // DO SOMETHING 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried in vain to find a solution for this issue, but to
I have seen a TON of people reporting this issue online, but no actual
I have a little issue I'm trying to find a solution for. Basically, imagine
I am running into this issue of releasing an already released object but can't
I have this working definition: IDENTIFIER [a-zA-Z][a-zA-Z0-9]* I don't want to keep repeating the
I think I read every single web page relating to this problem but I
First off, there's a bit of background to this issue available on my blog:
This is a really strange issue. I have developed a small MVC application and
This is a follow up issue relating to the answer for SQL placeholder in
I have this question relating to Lucene. I have a form and I 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.