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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:10:16+00:00 2026-06-14T05:10:16+00:00

Everything i have read, leads more to event handlers being added using .live(), .on(),

  • 0

Everything i have read, leads more to event handlers being added using .live(), .on(), .bind(), .delegate(), etc..

I asked a question earlier that may not be coming across correctly, so i voted to delete that one and re-ask a much simpler one, from which i can do the rest i believe.

Is there a way to clear the innerhtml of an HTML element with a predefined class, including those loaded dynamically via AJAX, etc.

So every time an ajax call puts

<div class="triggerElement">something here...</div>

or similar on the page, i need it to be emptied. I think i have explained that correctly. Just let me know if not.

EDIT

Seems to be a lot of confusion. .empty & others like it will not work. If you call

$(".omButton").empty();

from the index, then some other module loads something later via AJAX with that same class, it WILL NOT empty that. If i have the element on the page first, then call it, yes it will work….

I need something along the lines of .live or .delegate that will work for any content loaded after the fact, as i have tried .empty and .html and neither work for the content that is loaded with AJAX.

Not sure how else to explain this. Thought it was pretty simple. Sorry!

EDIT 2…

index contains empty function

$(function(){
    $('.omButton').empty();
    $ajax... to load "loadedContent"
});

<div class="omButton"></div>
<div id="loadedContent"></div>

ajax returns

json_encode(array('test' => '<div class="omButton">Button Text</div>'));

So now the HTML on the index is

<div id="loadedContent"><div class="omButton">Button Text</div></div>

However since the inner div was not there when the page loaded, the .empty does not effect it. I need something that i can put on the page load that “monitors” for any occurance (static or dynamic) of it and empties it.

Hopefully that helps?

  • 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-14T05:10:17+00:00Added an answer on June 14, 2026 at 5:10 am

    Try using $.ajaxComplete() – as this is triggered after every ajax request completes

    $('body').ajaxComplete(function() {
      $('.triggerElement').empty();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read the docs and everything but I'm very confused. I never needed
Rather than have everything in one big dialog, I'm looking at being able to
I'm using CoreAudio on iOS 5 to play MIDI files. I have everything setup,
So I read similar posts, and I think I have everything I need In
Everything I have read says that when making a managed stored procedure, to right
I have everything same in 10.04 LTS, local in parallels 7 On ec2 instances
I have wrote a custom MultipleChoiceField. I have everything working ok but when I
I feel like I have everything I need in my routes.rb, my controller, and
I am currently implementing a ListView populated with CheckedTextViews and have everything working just
I am making a fighting game in Flash and while I have everything running,

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.