0

I'm creating a very simple app, and I'm using Onsen UI and purely JavaScript (no Angular, React, or Vue). This is the first time a use this framework, but so far seems pretty simple and straight forward, except the isShow() method. I have a dialog that I open using:

document.getElementById(id).show({ animation: "fade" });

But now I need to know how to check if the dialog is open or not. I thought that using something like this would work:

console.log(document.getElementById(id).isShown());

But I get a document.getElementById(...).isShown is not a function error message.The only thing I can find is what is says inn the Onsen UI documentation: isShown() Returns whether the popover is visible or not.

How can I determine if a Dialog <ons-dialog> element is open (visible) in Onsen UI?

Cœur
  • 37,241
  • 25
  • 195
  • 267
cubanGuy
  • 1,226
  • 3
  • 26
  • 48

1 Answers1

1

The isShown() method was part of Onsen UI v1. For v2 you can access visible property and get the same value. Docs here.

Fran Dios
  • 3,482
  • 2
  • 15
  • 26
  • Thanks! I'll give it a try. In the meantime I used an answer that you gave a while ago: `el.style.display !== 'none'`, and `window.getComputedStyle(el)` also worked. – cubanGuy Jul 08 '17 at 01:35