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

Each time I click the Run as button, I get the following message. The
THIS IS THE FULL SCRIPT http://goo.gl/HoCxk I have a problem with this function: $('.message').click(function(){
open message box and long click on a message , as you can see
var message = 'Spoon!'; $('#foo').bind('click', function() { alert(message); }); message = 'Not in the
I want this: http://jqueryui.com/demos/dialog/#modal-message to happend when you click on ClickMe. how to do
How can I display an alert or a message after a user clicks a
click the button to call this method: private void goRegister(final boolean isUsername) { new
(the example code below is self-contained and runnable, you can try it, it won't
There are button (id= hide_message_button) and message(id=message). The click on the button should hide/show
I want to popup a message when user click on submit button between the

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.