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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:51:36+00:00 2026-05-15T13:51:36+00:00

I am new to Jquery and in learning phase. I have written a test

  • 0

I am new to Jquery and in learning phase.
I have written a test program in it.

<html>
    <head>
        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $("Button").click(function(){
                    $(this).parents(".ex").hide();
                });
                $(":button").click(function(){
                    $(this).parents(".ex").hide("slow");
                });

            });
        </script>
        <style type="text/css">
            .ex{
                background-color: #e5eecc;
                padding: 7px;
                border: solid 1px #c3c3c3;
            }
        </style>
    </head>
    <body>
        <h3>Island Trading</h3>
        <div class="ex">
            <input type="button" name="hid" value="Hide Me slowly">
            <p>  Contact: Helen Bennett</p>
            <p>Garden House Crowther Way</p>
            <p>London</p>
        </div>
        <h3>Paris spécialités</h3>
        <div class="ex">
            <button type="button">Hide Me Quick</button>
            <p> Contact: Marie Bertrand</p>
            <p>265, Boulevard Charonne</p>
            <p>Paris</p>
        </div>
    </body>
</html>

This is working as expected. Whenever i click Hide me slowly, it is hidden slowly. As the event with the selector “:button” asks to do so. and
similarly for Hide me Quick — the selector is “Button”, it is hidden quickly.

But once i change the order of the event handling functions in the script, both of them are hidden slowly.
Change in code in

<script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $(":button").click(function(){
                $(this).parents(".ex").hide("slow");
            });

            $("Button").click(function(){
                $(this).parents(".ex").hide();
            });

    });
</script>

My question is, i did not changed the selectors only the order is modified. For the selector “Button” i have written event handling function to only hide and did not specified “slow”. But then it is hiding slowly. can you please look into it and let me know why?

  • 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-15T13:51:37+00:00Added an answer on May 15, 2026 at 1:51 pm

    :button will match inputs of type button as well as button elements. Button will match only button elements. So, the Button element in your document gets two handlers bound to its click event since it is being selected by both selectors.

    Proof: http://jsfiddle.net/g7deV/

    (When you click on ‘hide me quick’, both alerts will pop up. If you change the order of event handlers, both alerts will still pop up, only in the reverse order)

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

Sidebar

Related Questions

I am new to web development, learning ASP.NET. I used some JQuery script so
New to jQuery, I have a script that returns data from an XML file.
i'm relatively new to jquery and javascript and am trying to pass a unique
Ok, I am new to JQuery, I have a modal that has a asp:Literal
New to javascript/jquery and having a hard time with using this or $(this) to
I'm new to jquery and asp.net so please forgive if this is an obvious
I'm new to jQuery so hopefully there is an easy answer to this. I
I am new to jQuery.just learn and use it for 3 weeks until now.
I am new to JQuery. I'm reading JQuery in action, but only up to
So I am pretty new to JQuery and just spent 5 hours getting this

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.