Written by

Analyst/Developer
Question Andy Coutinho · Apr 1, 2021

zenPage

Hello, in a zen page sometimes I find document.getElementbyId("ID") to set a propertybut also zen("ID").setPr.... So what is the real difference and limitations of each?

Product version: IRIS 2020.4

Comments

Joel Solon · Apr 5, 2021

zen(id) is shorthand for zenPage.getComponentById(id) which as @Vitaliy Serdtsev said gives you access to the Zen component identified by id. document.getElementById(id) gives you access to the element identified by id in HTML/JavaScript document object model. Since a Zen component could comprise several HTML elements, it's usually better to use zen(id).

0
Stephen Canzano · Apr 7, 2021

You can look at the contents of zenutils.js to see the actual details of the zen(id) function.

0
Joel Solon  Apr 7, 2021 to Stephen Canzano

...and learn about other useful shortcuts such as zenGetProp() and zenSetProp().

0