We help IT Professionals succeed at work.
Get Started

Attaching a click event to buttons (with one lying in front of the other) in HTML5 and such that both fire when the button in front is clicked

Last Modified: 2019-03-09
I had this question after viewing Using HTML5 and CSS How to place one element in front of another elemen.

This Question is related to a question I previously asked on this forum and which was answered very kindly by Julian Hansen (please see my previous question for details).
I would now like to attach a click event to both these buttons, such that when I click the button in front, the click event of both buttons should fire one after the other. So assuming we display an alert in response to clicking the button which is in front which says ("Button in front clicked") and the button behind click displays an alert ("button behind clicked"), in response to clicking the button in front (green button), I would like to first see and alert saying "button in front clicked", and then when we dismiss this alert the next alert saying "button behind clicked".
Watch Question
Full Stack Developer
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE