jQuery

From Documentation
Revision as of 01:41, 2 March 2020 by Hawk (talk | contribs) (Created page with "{{ZKClient-sideReferencePageHeader}} ZK framework's Client Engine is based on [http://jquery.com/ jQuery], it's already bundled a custom jQuery. So you can use '''<tt>jq</tt>'''...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


ZK framework's Client Engine is based on jQuery, it's already bundled 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 of a developer tool.


Load a Different jQuery

If you want to load a different version of jQuery, which is not recommended, you need to avoid 2 versions of jQuery conflicts by noConflict() (Please refer to https://api.jquery.com/jquery.noconflict/)

    <script src="https://code.jquery.com/jquery-2.1.4.min.js" />
    <script>
        var jQuery2 = jQuery.noConflict(true);
        console.log(jq.fn.jquery);
        console.log(jQuery2.fn.jquery);
    </script>
  • Line 3: Use a different version (2.1.4) of jQuery with jQuery2



Subsections:



Last Update : 2020/03/02

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.