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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:29:33+00:00 2026-05-23T08:29:33+00:00

Question 1 I’ve just started learning jQuery and one thing that puzzles me is

  • 0

Question 1

I’ve just started learning jQuery and one thing that puzzles me is function() with a parameter in it, ie: function(e).

[Example 1]

 $("#rating a").click(function(e){
     // stop normal link click
     e.preventDefault();
 }

What is e in function(e)?

[Example 2]

$.post("test.php", function(data) {
    alert("Data Loaded: " + data);
});

How do you know what data is? I assume data is different from e in example 1.

I’m confused as to why function() is different in different senarios…


Question 2
Since we are talking about basic jQuery, here’s another jQuery question. What is the difference between this and $(this)?

[Example 3]

$(document).ready(function() {
 // use this to reset several forms at once
$("#reset").click(function() {
    $("form").each(function() {
        this.reset();
    });
});

[Example 4]

   $("a").hover(function(){
       $(this).parents("p").addClass("highlight");
   },function(){
       $(this).parents("p").removeClass("highlight");
   });

});

  • 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-23T08:29:33+00:00Added an answer on May 23, 2026 at 8:29 am

    function(e) -> this is passing in the event object as a parameter. Without e you just don’t have access to the event object.

    “this” is the object in context to whatever you’re doing. If you wrap “this” like $(this) then you have access to all the extensions that jQuery gives you. To be more clear, “this” is usually a DOM object, $(this) is a jQuery object.

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

Sidebar

Related Questions

Question: Upon click, I see that evt.target.attributes stores all of the attributes in an
Question: is there a better way to do that? VB.Net Function GuidToBase64(ByVal guid As
Question update: I have figured out that importing JQuery (even without using it at
Question Can I build a image database/library that has an e-commerce style checkout system
Question Is there a way to have a method that will always run anytime
Question Implement a function bool chainable(vector<string> v) , which takes a set of strings
Question i asked earlier along the same lines - jQuery - Selecting a child
Question I'm creating a service for my app, but there's probably pritty simple thing
Question: Can I override default functions in Javascript? Background: After figuring out that I
Question: Instead of getting transformed output from my ERB template, is there a parameter,

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.