html button css styling

So i have a html page with buttons that launch divs.

I'm using jquery javascript functions to display the divs
My working  page is this:

https://jsfiddle.net/hup11jh1/

How do I revise my button's css so after I click a button.... whatever button I clicked on has a red border of this style?:

border: 2px solid #ff0000;
LVL 1
maqskywalkerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
I've updated your fiddle to show the changes.

Basically, add a .active class to your CSS, and then add the active class to the clicked button and remove it from the others.

You should probably look at refactoring your code so that you only have one click event. You seem to be replicating a lot of your code:

https://jsfiddle.net/ChrisStanyon/hup11jh1/1/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chris StanyonWebDevCommented:
Here's another update to the fiddle, that reduces the click event to just one. The event is bound to your buttons (with a class of showDiv) and it shows div that's stored in the data-div attribute of each button

https://jsfiddle.net/ChrisStanyon/hup11jh1/2/
0
maqskywalkerAuthor Commented:
Great solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.