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?
Comments
zen(id) works with the component object model, and document.getElementbyId(id) works with the document object model.
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().