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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:18:49+00:00 2026-05-20T07:18:49+00:00

I have a blank <a> tag that content is loaded into via an external

  • 0

I have a blank <a> tag that content is loaded into via an external piece of javascript. I want to observe the <a> and when its content changes perform another task. The content will only ever change once.

Can this be done?

I am using also using jQuery.

Thanks in advance

  • 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-20T07:18:50+00:00Added an answer on May 20, 2026 at 7:18 am

    You can use a mixture out of jQuery && DOM Level 3 events (see browser support below).

    If you want to check for any changes within the content, you could do this:

    var $a = $('a');
    
    $a.one('DOMNodeInserted', function(e) {
        console.log('content changed!: ', e);    
    
        console.log('new content: ', $(this).html());   
    });
    
    $a.one('DOMAttrModified', function(e) {
        console.log('attribute changed!: ');        
    
        console.log('attribute that was changed: ', e.attrName);
    });
    

    See this code in action: http://jsfiddle.net/wJbMj/1/

    Reference: DOMNodeInserted, DOMAttrModified


    While the above solution is actually pretty convinient to me, it’ll only work in browser that support those events. To have a more generic solution, you can hook into jQuerys setter methods. The downside in this solution is, that you will only catch changes that were done through jQuery.

    var _oldAttr = $.fn.attr;
    $.fn.attr = function() {
        console.log('changed attr: ', arguments[0]);
        console.log('new value: ', arguments[1]);
        return _oldAttr.apply(this, arguments);
    };
    

    You could hook into .text() and .html() the exact same way. You would need to check if the this value within the overwritten methods represent the correct DOMnode.

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

Sidebar

Related Questions

I have a basic PDF file that I has 5 different blank content areas
I have created blank Asp.Net-MVC 3 web application and want to write my own
I have a field that may be blank, so I need to use Object.try,
I have a SQL Report that insists on printing an extra blank page at
I have a text and table within another table td tag. That inner table
I have a UITableView that has 1 blank row at the top of it,
I have a vertical layout that I want to remain centered on the page.
I want to break down a JSON string into smaller objects. I have two
I have a DIV tag generated from jQuery that goes like this: $('#results') .append('<DIV
I have installed a complete blank theme with no CSS in my new wordpress

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.