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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:36:24+00:00 2026-06-13T09:36:24+00:00

What is the event $(document).ready(function(){ $(a).click(function(event){ alert(Thanks for visiting!); }); }); and also this

  • 0

What is the event

 $(document).ready(function(){
   $("a").click(function(event){
     alert("Thanks for visiting!");
   });
 });

and also this one

 $(document).ready(function(){
   $("a").click(function(){
     alert("Thanks for visiting!");
   });
 });

these two JS blocks are doing the same thing, but one with an event, if someone could explain what is function(event), also I saw something like function(e),function(g), what are those? Is there a tutorial I could learn?

  • 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-06-13T09:36:25+00:00Added an answer on June 13, 2026 at 9:36 am

    The callback function that you’re providing to $("a").click is a function that takes an argument. This argument is an event object containing details about the object. Your function declaration can take this argument with any name you like — event, e, g… and it can also simply leave it out since you’re not using it inside of your function.

    Consider that these two functions are essentially the same:

    function foo(hi) {
       alert(hi);
    }
    
    function foo(bye) {
       alert(bye);
    }
    

    And that you may leave out the argument if it’s not used:

    function bar() {
       alert("hello!");
    }
    
    bar(12345);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<script type=text/javascript> $(document).ready(function() { $(a).click(function(event) { alert(Thanks for visiting!); }); }); </script> <style> div.iframe-link
$(document).ready(function() { function GetDeals() { alert($(this).attr(id)); } $('.filterResult').live(click, function(event) { GetDeals(); }); }); What
$(document).ready(function() { $(#cover img).click(function(event) { var selected_script = $(this).attr('id'); //alert(selected_script); //alert('#run_'+selected_script); $('#run_'+selected_script).hide(); }); });
i can reference link with specific id with following code $(document).ready(function(){ $(a#example_link_id).click(function(event){ var url
What wrong with this validation: Jquery: $(document).ready(function(){ $(#addcmd).attr(disabled,disabled); $(#cmdstxt).keypress( function(event){ var txt=$(#cmdstxt); if( txt.val().length
i see there is this syntax for detecting any button click <script type=text/javascript> $(document).ready(function()
I have 2 separate js files: //first.js $(document).ready(function(){ $(#someButton).click(function(event){ showMessageBox(test); }); }); and the
Does a click event always need to be placed inside (document).ready(function() as example below
Consider the following code: $(document).ready(function() { $(body).append(<div class='outer'><span class='inner'>Click me</span></div>); $(html).click(function(event) { var targetClass
<script type=text/javascript> $(document).ready(function() { $(body).css(display, none); $(body).fadeIn(slow); $(a.link).click(function(event){ event.preventDefault(); linkLocation = this.href; $(body).fadeOut(slow, redirectPage);

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.