jQuery"
From Documentation
m (correct highlight (via JWB)) |
|||
Line 1: | Line 1: | ||
{{ZKClient-sideReferencePageHeader}} | {{ZKClient-sideReferencePageHeader}} | ||
− | ZK framework's Client Engine uses [http://jquery.com/ jQuery]. It contains a custom jQuery. So you can use '''< | + | ZK framework's Client Engine uses [http://jquery.com/ jQuery]. It contains a custom jQuery. So you can use '''<code>jq</code>''' or '''<code>$</code>''' as a jQuery object like: |
<source lang='javascript'> | <source lang='javascript'> | ||
Line 15: | Line 15: | ||
= Version = | = Version = | ||
− | To obtain the jQuery version bundled with your ZK version enter < | + | To obtain the jQuery version bundled with your ZK version enter <code>jq.fn.jquery</code> into Console tab in a developer tool. |
= Load a Different jQuery = | = Load a Different jQuery = | ||
− | You can load a different version of jQuery by < | + | You can load a different version of jQuery by <code><script/></code> or <code><?script?></code>. Because ZK always load that script later than ZK scripts, the different version of jQuery will override <code>$</code>. Therefore, you can access 2 versions of jquery with different variables: |
− | * < | + | * <code>jq</code> to access ZK's bundled jQuery |
− | * < | + | * <code>$</code> to access the different version of jQuery |
Please check examples: [https://github.com/zkoss/zkbooks/blob/master/clientreference/src/main/webapp/jquery.zul jquery.zul], [https://github.com/zkoss/zkbooks/blob/master/clientreference/src/main/webapp/jquery2.zul jquery2] | Please check examples: [https://github.com/zkoss/zkbooks/blob/master/clientreference/src/main/webapp/jquery.zul jquery.zul], [https://github.com/zkoss/zkbooks/blob/master/clientreference/src/main/webapp/jquery2.zul jquery2] |
Revision as of 03:33, 18 January 2022
ZK framework's Client Engine uses jQuery. It contains a custom jQuery. So you can use jq
or $
as a jQuery object like:
$( "div" ).click(function() {
//...
});
jq(mySelector).css( "background-color" );
You should consider implementing your client code with the bundled jQuery first. For API details, please refer to jQuery Documentation for details.
Version
To obtain the jQuery version bundled with your ZK version enter jq.fn.jquery
into Console tab in a developer tool.
Load a Different jQuery
You can load a different version of jQuery by <script/>
or <?script?>
. Because ZK always load that script later than ZK scripts, the different version of jQuery will override $
. Therefore, you can access 2 versions of jquery with different variables:
jq
to access ZK's bundled jQuery$
to access the different version of jQuery
Please check examples: jquery.zul, jquery2