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

  • Home
  • SEARCH
  • 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 6690687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:39:58+00:00 2026-05-26T05:39:58+00:00

When I do <a onclick=’foo()’></a> According to firebug – it creates anonymous function like

  • 0

When I do

<a onclick='foo()'></a>

According to firebug – it creates anonymous function

like this :

function onclick(event) { foo(); } 

But how does he knows how to attach those both to each other ?

( maybe the click came from DIV and not from this A )

I’m missing this point…

Can I please have some Explanation ?

  • 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-26T05:39:58+00:00Added an answer on May 26, 2026 at 5:39 am

    When you do <a onclick="foo()"></a>, you should be beaten with a dirty stick. Repeatedly.

    Anyway, this line bind an anonymous function to the DOM node. Each DOM element has them. Inspect your page an you will see all the properties which each dom element has.

    Instead of mixing you layers of web ( JS code has no place in HTML ) , you should attach the events from an external JS file, which you include right before </body>. In addition to making the page load faster on older browers, this will effectively place all the content of that file in onDomReady event.

    Please read more about how to attach events here : http://www.quirksmode.org/js/events_advanced.html

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

Sidebar

Related Questions

I am using JQuery onclick submit event like this <script type=text/javascript> $(function(){ $('#button').click(function(){ $('#form').submit();
i place the onClick event in asp buttons. but it is showing error like
i used a onclick event for this js function: window.opener.location.href =foobar; After loading foobar
In a TImage's OnClick event, I would like to extract the x,y coordinates of
I have a onclick event that is like: public void OnMyButton_Click(object sender, EventArgs e)
I am attaching onclick event on dynamically created button but the event is not
I am chnaging the image src onClick event like below IF the hyperlink is
Problem : Need onclick event to pause/unpause a Youtube video, but impossible to add
Why does the onclick handler below trigger an elem.parentNode is not a function error?
When I include an 'onClick' attribute in setInnerXTHML() like this: var innerHtml = '<span>Build

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.