Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Buttons Aren't Deselecting After Click

I'm making a calculator app for class and I have run into a snag while implementing keyboard listeners. Everything on the keyboard side works properly, but I have found that when I am forced to physically click on a button, such as the more obscure functions which don't have keyboard keys, the button is staying focused. This normally wouldn't be an issue, except that every time I press the 'enter' key to solve the inputted function, the calculator thinks I'm pressing that focused button.

CSS hasn't worked and I can't find anything on Google for how to deactivate this. If it matters, I am using Bootstrap 3 for this. We haven't covered JQuery yet, so I'm hoping for a pure JS way to solve this if it's possible.

Thanks!

like image 443
compostkicker Avatar asked Jan 29 '26 10:01

compostkicker


1 Answers

Thank you all for the responses. I tried both and my issue was solved, however it took either an extra function or an extra listener. I ended up finding the blur() function and calling it at the end of my switch statement which controls clicks accomplished what I wanted. Thank you again though!

like image 112
compostkicker Avatar answered Jan 31 '26 01:01

compostkicker