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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:01:39+00:00 2026-05-31T17:01:39+00:00

I enjoy running custom scripts on pages that I do not own or control.

  • 0

I enjoy running custom scripts on pages that I do not own or control. Many times these pages have dynamically created content that I would like to apply a function to.

Is this possible? If so, how can I do this? Ideally I am looking for something live jQuery’s live method, except instead of binding an event like click it would be more like an event that happens when the element is loaded in the DOM. load event would work for some elements but I don’t think for all…

For this question, assume that you cannot look at or change the code that is inserting the DOM nodes. I would like a technique that I could use in a userscript or bookmarklet that could be used across multiple unrelated sites.

Edit: I am looking for something to use on my invert colors bookmarklet: JavaScript: Invert color on all elements of a page

  • 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-31T17:01:40+00:00Added an answer on May 31, 2026 at 5:01 pm

    Assuming you’re running a browser like Firefox or Chrome, you could listen for the DOMNodeInserted event:

    $(document).on('DOMNodeInserted', function(e) {
        $(e.target).css({ color : '#c00' });
    });
    
    $('body').append('<div>test</div>');​
    

    Fiddle: http://jsfiddle.net/VeF6g/ (probably fails in IE)

    Update:
    The event is deprecated. You should use a MutationObserver:

    var observer = new MutationObserver(function(mutationList) {
        for (var mutation of mutationList) {
            for (var child of mutation.addedNodes) {
                child.style.color = '#c00';
            }
        }
    });
    observer.observe(document, {childList: true, subtree: true});
    
    // ready? Then stop listening with
    observer.disconnect();
    

    More information here: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver

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

Sidebar

Related Questions

I seem to enjoy designing new UIViews and UIControls that implement their own -drawRect:
I enjoy GWT because I can have compile-time type safe code that runs in
I have a rails app that I enjoy developing on a sever much more
I'm running myself through a C++ text book that I have as a refresher
I enjoy developing algorithms using the STL, however, I have this recurring problem where
I'm a web coder: I currently enjoy AS3 and deal with PHP. I own
Is there any way that I could enjoy a decodeValue() function in PHP, too?
I have just recently discovered how much I enjoy developing code the TDD way:
I am not a mathematician. I enjoy a good math puzzle, but I admit
I enjoy working with Google Analytics and the ways that I am able to

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.