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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:26:01+00:00 2026-05-20T14:26:01+00:00

When I click the message button, it won’t call alert() ..can anybody check the

  • 0

When I click the message button, it won’t call alert() ..can anybody check the code please?

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Homepage</title>
    <script type="text/javascript" src="lib/jquery/jquery-1.4.2.js"></script>
    <script type="text/javascript" src="lib/jquery/jquery-ui-1.8.10.custom.min.js"></script>
    <script type="text/javascript" src="lib/jquery/jquery.dmDropDownMenu.js"></script>
    <script type="text/javascript" src="lib/jquery/watermark.js"></script>

    <link rel="stylesheet" type="text/css" href="/jquery-ui-1.8.10.custom.css" />
    <link rel="stylesheet" type="text/css" href="/stylez.css" />
    <script type="text/javascript" /> $(document).ready( function(){ $('#buttons button').click(function(){ switch( $('buttons').id){ case "mail": alert(1); break; } }); }); </script>
</head>

<body>
    <table width="1000" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td id="columnA">    
                <div id="buttons">
                    <button id="mail" class="menubutton">Message</button><br/>
                </div>
            </td>
        </tr>
    </table>    
</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-20T14:26:01+00:00Added an answer on May 20, 2026 at 2:26 pm

    If you want to check which button has been clicked and you are going to have multiple buttons, you can use $(this) inside the .click(), it will reference THE object which was clicked. So change the switch to:

    switch($(this).attr('id')) {
    

    The full lot:

    $('#buttons button').click(function(){
        switch( $(this).attr('id') ){
            case "mail":
                alert(1);
            break;
        }
    });
    

    See a working demo here

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

Sidebar

Related Questions

On my webpage, I click on a button and it makes a ajax call
We’re getting the following error message when we click on Search Settings for a
User click on a link button and it will direct them to a url
When using $('.foo').click(function(){ alert(I haz class alertz!); return false; }); in application.js, and <a
To make click-able divs, I do: <div class=clickable url=http://google.com> blah blah </div> and then
When I right-click a solution in VS2008 and select Check In... I am presented
I have a button which I use for sending a message. When the message
When I click the submit button on my form, I get a null reference
If you put cursor in the first input, then click the button, you get
The 'click sound' in question is actually a system wide preference, so I only

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.