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

The Archive Base Latest Questions

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

If the HTML is like: <a href="javascript:void(0)" id="link">Click Me</a> and I set the eventHandler

  • 0

If the HTML is like:

<a href="javascript:void(0)" id="link">Click Me</a>

and I set the eventHandler for click as

ele.addEventListener('click', clickme, false);

What’s the pretty standard way of getting the value of ele in handler.

I succeed getting the value of ele in chrome by: (working example – http://jsfiddle.net/hy5Pz/4/ )

function clickme(e){
  var ele = e.toElement;
  ele.innerText = "I got clicked"; 
}

and in Firefox by: (working example – http://jsfiddle.net/hy5Pz/3/ )

function clickme(e){
  var ele = e.rangeParent;
  ele.data="I got clicked";
}

I am new to JavaScript so I want to know if there is a pretty standard cross-useragent way of doing it.

  • 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:55:13+00:00Added an answer on May 31, 2026 at 7:55 pm

    I believe

    var ele = e.currentTarget || e.srcElement;
    

    Will work in most browsers. It basically tries to use e.target first, and if that’s not found, use e.srcElement instead. e.target is used in good browsers, e.srcElement in IE.

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

Sidebar

Related Questions

I have a html like this: <html> <head> <link rel=stylesheet type=text/css media=all href=style.css> </head>
Given an HTML link like <a href=urltxt class=someclass close=true>texttxt</a> how can I isolate the
Should I use JSF2 resources instead of plain html like <link href... or url(image.png)
I'd like to get to all the a href links within the html string
I have HTML like this: <a href=# class=modalInput glow rel=#newsletter >Newsletter!</a> This opens a
I have html like so: <div class=foo> (<a href=forum.example.com>forum</a>) <p> Some html here.... </div>
I have html like this. <span class=gallery-open-item year-icon-Yes 2010> <a href=/year/none> </a> </span> I
I have some HTML like this: <h4 class=box_header clearfix> <span> <a rel=dialog href=http://www.google.com/?q=word>Search</a> </span>
I have a page with HTML like this: <a href=1>reply</a> <a href=2>reply</a> I need
I have my html code like: <ul id=abc> <li><a href=http://koolfinance.blogspot.com/2011/06/laxmi-bank.html>Laxmi Bank</a></li> <li><a href=http://koolfinance.blogspot.com/2011/06/nepal-development-bank.html>Nepal Development

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.