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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:21:47+00:00 2026-05-12T08:21:47+00:00

If you know a better way to do this then please let me know.

  • 0

If you know a better way to do this then please let me know.
Right I have a page which will contain lots of buttons, charts and tables.
I have read about stopping event propogation and that’s what I’ll be using.
I want to enable help on cerain elements. I have a checkbox which changes the cursor on help enabled divs. What I want to do is prepend a help function before the normal click behaviour.

Basically it’s like this.

<input type="button" value="Click me" onclick="alert ('hello')" />

what i want is that if the checkbox is clicked I add a css class (already done) and then I add a click handler before the normal click. When the element is clicked then the helpfunction is run and the default button click handler is not fired. When the help checkbox is unchecked I want to remove the help function.
I realise that I could hardocde this for each element and have a check in the helperfunction to see if the checkbox is checked. But I’d prefer a more generic way of doing it.

Thanks

John

  • 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-12T08:21:48+00:00Added an answer on May 12, 2026 at 8:21 am
            $(":button").each(function() {
    
                // your button
                var btn = $(this); 
    
                // original click handler
                var clickhandler = btn.attr("onclick");
                btn.attr("onclick", "return false;");
    
                // new click handler
                btn.click(function() {
    
                    if ($("#chkbox").attr("checked") == true) {
    
                        // TODO: show your help
                        // TODO: catch event
    
                    }
                    else {
    
                        clickhandler();
    
                    }
                });
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know I'm not asking this quite right, either. Please help me better form
I don't have much experience with databases, so I don't know which is better
There doesn't seem to be a dictionary.AddRange() method. Does anyone know a better way
I'd like to know if there's a better approach to this problem. I want
I'd like to know whether this approach is correct or if their are better
I have a login.jsp page which contains a login form. Once logged in the
Does anyone know of a better GUI client for displaying Windows System Monitor log
Is it better to use NGEN an ASP.NET application when we know it is
Are there any VC++ settings I should know about to generate better PDB files
Know of any good libraries for this? I did some searches and didn't come

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.