Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Unleash the full power of jQuery in Haxe.
Haxe

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
jQuery
test
.gitignore
.paths
.project
JQuery.hx
README.md
compile.hxml
haxelib.xml
jQueryExternForHaxe.hxproj

README.md

jQueryExtern

jQuery extern for haXe. Currently support jQuery version: 1.7.1

You may check my blog for updates.

Download and Install

Install via haxelib: haxelib install jQueryExtern

Then put -lib jQueryExtern into your hxml.

Or you can manually download and then place the folder jQuery into your project source folder.

Usage

Typically:

import jQuery.JQuery;

class Main {
    static public function main():Void {
        new JQuery(function():Void { //when document is ready
            //your magic
        });
    }
}

It is same as how you use jQuery in JS. But instead of $, you refer jQuery as JQuery.

eg. Hiding all li object:

new JQuery("li").hide(); //same as $("li").hide() in JS

Static methods of jQuery can be accessed from JQuery._static or from JQueryStatic.

eg. A ajax example:

JQuery._static.get("ajax/test.html", function(data) {
    js.Lib.alert(data);
});

Remember jQueryExtern is simply an extern, you have to link jQuery in your html file.

eg. In your <head>:

<!-- jQuery from Google CDN -->
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js"></script>

<!-- Your haxe compiled script: -->
<script type="text/javascript" src="Main.js"></script>

js.JQuery in haxe std lib VS jQueryExtern

js.JQuery jQueryExtern
import statement "import js.JQuery;" "import jQuery.JQuery;"
jQuery API version partial 1.6.4 complete 1.7.1
refer jQuery in output as "js.JQuery" "$" (or "jQuery" if -D JQUERY_NOCONFLICT)
include jQuery in output yes (can be opt-out by -D noEmbedJS) no, use CDN instead

License

jQueryExtern is released in the public domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

jQuery's license can be found at http://jquery.org/license.

Something went wrong with that request. Please try again.