Detect if Specific Modal is displayed/visible using JavaScript

I'm trying to figure out if I can detect when a specific modal (see attached image) is displayed using pure JS (no jQuery). If you go to  https://www.bankofthewest.com/personal-banking/checking-accounts.html in Chrome, Incognito mode (or just clear your cookies in standard mode, you see the "State Selector" modal show. Once a State is selected and submitted the page will close the modal and refresh. Is there any way to detect if this modal is being displayed and if so, how?

Thanks!
stateSelectorExample.png
894359Asked:
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.

David S.Commented:
jQuery can be very helpful, but it's not magic, so of course something that can be done with it can be done without it.

In this case it seems to be fairly simple:
if(document.getElementById('stateSelectorModal').style.display==='block')

Open in new window

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
894359Author Commented:
Would it be any better to use something like this:

if(document.getElementById('stateSelectorModal').offsetHeight > 0)
0
David S.Commented:
You could do that, but there is more than one way to hide an element (and checking the offsetHeight only works for some of them), so you might as well just check the one that is being used.
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
Chrome

From novice to tech pro — start learning today.