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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:36:42+00:00 2026-05-12T18:36:42+00:00

To make it more clear what I need to do, here is the structure

  • 0

To make it more clear what I need to do, here is the structure of the search form / HTML page I am working with:

  ---
  |A|
  ---
 
 ---------   ---------   ---------
 |       |   |       |   |       |
 |   B   |   |   B   |   |   B   |
 |       |   |       |   |       |
 ---------   ---------   ---------
 
 ---------------------------------    ---------
 |                               |    |   C   |
 |                               |    ---------
 |                               |
 |               X               |    ---------
 |                               |    |   C   |
 |                               |    ---------
 |                               |
 ---------------------------------

The boxes A, B, C are buttons which can be clicked by the user.
The X is the content are where the search result will be displayed.

The boxes behave at the moment like this:

  • Click on A returns to the previous site (= a back button)
  • Click on B and C apply filter and submit the form (= retrieving the result set of the search)
  • Click on X does nothing – the search result shown here

This works all fine and well.


My new requirement is:

When the user clicks "anything else" then A, B, C or X then a help message appears in the content area.

As you can imagine, the HTML of the boxes is fairly different and nested, only the boxes of the same type (= same letter) share a CSS class.

E. g. C looks like this:


My first thought on how to implement this was:

  • Attaching an onclick listener to document.body
  • Check if the event.target is A, B, C or X or contained in any of them
  • If not, then the user has not clicked a GUI element and the help message is being displayed

This could be made more easy by attaching a common CSS class (gui-element) to all GUI elements so the document onclick event handler checks only if the event target has this common class.

The drawback is that if any new element e. g. D is introduced in the HTML it must have this CSS class, too.

Do you think the above approach is good or is there a more "elegant" way of doing this?

EDIT:

A few more details:

  • I am using YUI2 as JavaScript framework
  • I know the whole idea of the help message appearing onclick might be …uh annoying, but I have to do what I am told, sorry
  • 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-12T18:36:43+00:00Added an answer on May 12, 2026 at 6:36 pm

    I would go with your first thought, because it would be more maintainable (at least for me)

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

Sidebar

Ask A Question

Stats

  • Questions 259k
  • Answers 259k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You should probably think about your (lack of) parentheses. I'm… May 13, 2026 at 11:15 am
  • Editorial Team
    Editorial Team added an answer The missing constructor belongs to Ehcache 1.3, and it still… May 13, 2026 at 11:15 am
  • Editorial Team
    Editorial Team added an answer You are correct. Since your request is asynchronous, the code… May 13, 2026 at 11:15 am

Related Questions

I am working on a web app where I have most of my pages
Is it possible to make my own website as iPhone friendly format when user
I'm not familiar with ADO.NET Data Services but it looks usable. All I need
Right now, I'm extremely frustrated because I was in the process of developing some

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.