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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:42:17+00:00 2026-05-31T19:42:17+00:00

Background : I’m currently writing a greasemonkey script that embeds/modifies a specific page’s html.

  • 0

Background:
I’m currently writing a greasemonkey script that embeds/modifies a specific page’s html. The page is setup with 3 nested divs. Of those 3 divs, I can only add an event listener to the outer most div(This is due to other events and the such already added to the elements). With the inner most div, links are added via AJAX/COMET. As with the inner divs, I can not add event handlers to these links due to the page’s current event handlings.

What I need: When a link in the inner most div is clicked, the event will bubble up to the outer most div. From the outer most div, is there a way 1: to tell if it was a link clicked in the inner most div, and if so, 2: how to get that link’s href

Please no jQuery solutions. It seems a bit over doing it sense this is the only javascript that will be embedded into the 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-31T19:42:19+00:00Added an answer on May 31, 2026 at 7:42 pm

    I would just use a simple cross-browser event listener and the event.target (or event.srcElement in IE), like so:

    var addEvent = function (el, ev, fn) {
        if (el.addEventListener) {
            el.addEventListener(ev, fn, false);
        } else if (el.attachEvent) {
            el.attachEvent('on' + ev, fn);
        } else {
            el['on' + ev] = fn;
        }
    };
    
    var outer = document.getElementById('outer');
    
    addEvent(outer, 'click', function(ev){
        ev = ev || window.event;
        var target = ev.target || ev.srcElement;
        alert(target.href);
    });
    

    See demo

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

Sidebar

Related Questions

Background I have a basic HTML page with an iframe that points to a
Background : With a Python Script, I scraping data (html) from a Website and
Background I have a dimension table that has a single record for each day.
Background, Part 1 I have a form that collects both frequency and duration from
background: I work on an asp.net web application that is on a company intranet.
Background: I'm writing a 'standard' (nothing special) web application in Ruby (not Rails) and
Background I am writing code in VS 2010, .NET 4, C#. Also, in case
Background: I have a css and a js that is used only by the
Background We currently use OpenID for authentication of users, and use the Claimed Identity
Background info: We are currently 3 web programmers (good, real-life friends, no distrust issues).

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.