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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:07:11+00:00 2026-05-15T16:07:11+00:00

(using http://code.google.com/p/svgweb/ ) window.onsvgload = function() { function onEnter(e) { var targ; if (!e)

  • 0

(using http://code.google.com/p/svgweb/)

window.onsvgload = function() {
  function onEnter(e) {          
    var targ;
    if (!e) var e = window.event;
    if (e.target) targ = e.target;
    else if (e.srcElement) targ = e.srcElement;
    if (targ.nodeType == 3) // defeat Safari bug
      targ = targ.parentNode;

    alert(targ.hasAttributeNS(null, 'id')); //displays false
    alert(targ.getAttributeNS(null, 'id')); //displays a blank dialog
    alert(targ.id); //displays a blank dialog
  }

  /* Seldom_Seen is a group element in the SVG - <g id="Seldom_Seen">... */
  document.getElementById('Seldom_Seen').addEventListener("mouseover", onEnter, false); //alert is blank
  document.getElementById('normal_dom_element').addEventListener("mouseover", onEnter, false); //alert displays id as expected
}

The event listening works for SVG elements. I just can’t seem to get the id. I can get other object properties like the x,y values. Anyway to get the ID of the targeted element?

  • 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-15T16:07:11+00:00Added an answer on May 15, 2026 at 4:07 pm

    maybe

    e.currentTarget
    

    but with jQuery, it is simply

    window.onsvgload = function() {
      $('#Seldom_Seen').mouseover(function(){ onEnter(this); });
      $('#normal_dom_element').mouseover(function(){ onEnter(this); });
    }
    
    function onEnter(obj) {
      alert($(obj).attr("id"));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using http://code.google.com/p/flex-iframe/ for showing html in an flex application. To set this up
I'm using http://code.google.com/p/flex-iframe/ for showing wikicontent in a flex app. <?xml version=1.0?> <mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml
I'm using socialoauth ( http://code.google.com/p/socialoauth/ ) to implement twitter & facebook logins for a
I'm using cocoa JSON framework http://code.google.com/p/json-framework/ Here is the result of an JSON output
I'm using the jquery Scrollview plugin ( http://code.google.com/p/jquery-scrollview/ ) to scroll drag a div
I am using the api twitterizer2 downloaded from http://code.google.com/p/twitterizer/downloads/list but when I try to
I am using the control library from http://code.google.com/p/gong-wpf-dragdrop/successfully for my listbox dragging operation.But there
I am using 'git' to checkout chromium code by following this document: http://code.google.com/p/chromium/wiki/UsingGit And
I'm using the JQuery DropdownChecklist as available from here: http://code.google.com/p/dropdown-check-list/ Basically I'm using some
I'm using this plugin for jquery called resize-crop: http://code.google.com/p/resize-crop/ The problem with this is

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.