answered
2018-04-18 20:41:45 +0800
cor3000 6280 ● 2 ● 7 Hi here a simple example showing 2 variants http://zkfiddle.org/sample/6r4eqk/1-EL-to-JS
One using a client side listener w:onBind
another one using a custom client side widget attribute w:profile
.
I personally prefer the w:onBind since it guarantees the div is rendered when the listener invokes. E.g. a dynamically added div would call w:onBind later.
Whereas afterMount is more global and invokes after the page rendering is done. Dynamic changes are not covered.
However in both cases the EL is expanded into the JS string. Note the single quotes around the EL to form a valid JS string.
I hope this helps... Other alternatives exist, if you need something more specific let me know.