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

The Archive Base Latest Questions

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

I am trying o learn jQUERY , i am trying with different types of

  • 0

I am trying o learn jQUERY , i am trying with different types of things in jquery .
I got this query , on click of a button , i am using the click funcion of a button to call another function , as shown .

But this isn’t working .

Could you please tell me , cant we use the click this way

$("button").click() instead of standard  $("button").click(function(){

=====

This is my code

<html>
<head>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" >
 </script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click()
{
   callMe();

}
});

function callMe()
{
 $("p").hide();
}
</script>
</head>

<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
  • 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-26T12:39:56+00:00Added an answer on May 26, 2026 at 12:39 pm

    jQuery is a library built for the JavaScript language, not an actual language itself, and is thus restricted to what JavaScript lets it do.

    $("button").click()
    {
       callMe();
    }
    

    So why the above won’t work is because .click() is a method in jQuery that takes in arguments/parameters, not an actual part of the JavaScript language itself, which doesn’t let you use a block in that way.

    $("button").click(function()
    {
       callMe();
    });
    

    The function itself is an argument/parameter being passed to the click method. See if you can understand what’s going on this way:

    var myFunction = function()
    {
       callMe();
    };
    $("button").click(myFunction);
    

    Or this way:

    function myFunction()
    {
       callMe();
    }
    $("button").click(myFunction);
    

    The above three code blocks would all cause callMe() to be called when anything matching button is clicked.

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

Sidebar

Related Questions

I am trying to learn jQuery. I keep seeing people using different methods of
I'm trying to learn jquery, I've some basics of javascript. I've written this piece
I have some javascript that I'm trying to retool using jQuery to learn the
I'm trying to learn JQuery and I stumble upon this script in one of
I'm trying to learn jQuery's ajax functions. I've got it working, but jQuery doesn't
I am trying to learn javascript/jquery, using firebug to debug and have built a
I have been experimenting and trying to learn JQuery, using AJAX to consume a
new to jquery here but I'm trying to learn some different stuff that's been
I am trying to learn making ajax calls using jQuery. But I am stuck
I'm trying to learn jQuery, to make up for my anemic javascript skills. As

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.