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
00
3 0 4 86
Log in or sign up to continue

Replies

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).

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

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