jQueryExtern 2.0.5

Unleash the full power of jQuery in Haxe.

Released 2016-02-22.

To install, run:

haxelib install jQueryExtern 2.0.5

See using Haxelib in Haxelib documentation for more information.

Current version2.0.5
StatisticsInstalled 4204 times
Tags extern, js



Part of jQueryExtern is being merged back to the Haxe std lib, resulting in a new extern in the Haxe std lib. If you're using Haxe 3.3+, you should switch to the new std extern. You may checkout the haxe3.3 branch of jQueryExtern, which is a drop-in replacement to the new std extern with advanced functionalities.

jQueryExtern Build Status

jQuery extern for Haxe.

Currently supports jQuery version up to 1.12.1 / 2.2.1. Requires Haxe 3.1.0+.

You may check my blog for updates.

Download and Install

Install via haxelib: haxelib install jQueryExtern

Then put -lib jQueryExtern into your hxml.



import 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.

eg. A ajax example:

JQuery._static.get("ajax/test.html", function(data) {

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

eg. In your <head>:

<!-- from jQuery's CDN (http://jquery.com/download/#using-jquery-with-a-cdn) -->
<script src="//code.jquery.com/jquery-1.12.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 API version partial 1.6.4 complete 1.12.1 / 2.2.1
refer jQuery in output as js.JQuery $ (or jQuery if --macro jQuery.haxe.Config.setNative('jQuery'))
include jQuery in output no (can be opt-in by -D embed-js) no, use CDN instead

In fact, since both js.JQuery in haxe std lib and jQueryExtern are just extern files, they can be used in same project.

The following will compile and run perfectly.

function takesJQueryExtern(j:jQuery.JQuery):Void {
function takesJsJQuery(j:js.JQuery):Void {

var div = new js.JQuery("<div></div>");
takesJQueryExtern(untyped div);
takesJQueryExtern(cast div);

var div = new jQuery.JQuery("<div></div>");
takesJsJQuery(untyped div);
takesJsJQuery(cast div);

Like jQueryExtern?

Support me to maintain it -> http://www.patreon.com/andyli


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.