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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:44:49+00:00 2026-05-29T11:44:49+00:00

I have code <a href=javascript:someFunction(this); tabindex=0>Some text</a> Is it possible to pass element into

  • 0

I have code <a href="javascript:someFunction(this);" tabindex="0">Some text</a>

Is it possible to pass element into someFunction(link) {...} and use it later.

In debug mode I see the object but all properties are undefined.

When I was using onClick attribute like <a onClick="javascript:someFunction(this); it worked fine.

I am aware that this is probably not the best solution and I have seen the other questions, but it is really not my issue right now. I just need to do it this way for many reasons.

Thanks a lot

  • 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-29T11:44:50+00:00Added an answer on May 29, 2026 at 11:44 am

    If you don’t mind using jQuery (disregard this answer if you don’t), you can attach an event to your link:

    $('#id_of_your_link').on('click', function(event) {
      event.preventDefault();
      someFunction(this);
    });
    

    This code works for both keyboard navigation and mouse clicking: http://jsbin.com/ufapor. You can see the source code here: http://jsbin.com/ufapor/edit#javascript,html

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

Sidebar

Related Questions

I have this code : <a class=myLink href='http://www.website.it/'>Link</a> <script type=text/javascript> var stringToSend = ;
I have the javascript code for a link click: document.getElementById('giddy').onclick = function { alert(this.href);
i have this code: $('.access a').toggle(function() { $('link').attr('href', 'styles/accessstyles.css'); $('body').css('font-size', '16px'); }, function() {
I have an application that contains this code: <script src=Scripts/jquery-1.4.1.min.js type=text/javascript></script> <script src=Scripts/facebox.js type=text/javascript></script>
I have the following code: echo <script type='text/javascript'> if(window.location.href.toLowerCase().indexOf('test') != -1) { } else
In my XUL I have the following code fragments: <map name=KeypadMap> <area href=javascript:pad('A') coords=1,1,31,31
HI, I have this code for extracting the href and adding it to a
I have the following code on the my page... <a href=javascript:change_product_photo(2);><img id=alternate_product_photo_2 style=border-color:#666666; src=/v/vspfiles/photos/00-6189-2S.jpg
I have the following javascript into a index.php file: <script type=text/javascript> $('.showpics, .showpics2').live('click', function()
I have this code that creates links. /* Create a link to activate the

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.