GopherJS Bindings for jQuery
JavaScript Go Other
Latest commit a27a4f4 May 19, 2016 @rusco rusco Merge pull request #14 from kelwang/patch-1
Update jquery.go
Failed to load latest commit information.
test replace js.This Oct 20, 2015
.gitattributes Test Setup and more functions Feb 5, 2014
.gitignore Ignore .cs files Feb 5, 2014 update filenames Apr 21, 2014
jquery.go Update jquery.go May 19, 2016

jQuery Bindings for GopherJS


$ go get

How To Use

welcome.html file:

<!doctype html>
<html lang="en">
    <meta charset="utf-8">
    <title>Welcome to GopherJS with jQuery</title>
    <script src="resources/jquery-2.1.0.js"></script>
    <input id="name" type="text" value="" placeholder="What is your name ?" autofocus/>
    <span id="output"></span>
    <script src="welcome.js"></script>

welcome.go file:

package main

import ""

var jQuery = jquery.NewJQuery

const (
    INPUT  = "input#name"
    OUTPUT = "span#output"

func main() {

    //show jQuery Version on console:
    print("Your current jQuery version is: " + jQuery().Jquery)

    //catch keyup events on input#name element:
    jQuery(INPUT).On(jquery.KEYUP, func(e jquery.Event) {

        name := jQuery(e.Target).Val()
        name = jquery.Trim(name)

        //show welcome message:
        if len(name) > 0 {
            jQuery(OUTPUT).SetText("Welcome to GopherJS, " + name + " !")
        } else {

Compile welcome.go:

$ gopherjs build welcome.go


In the "tests" folder are QUnit Tests, run the server with:

"go run server.go" and open a browser: http://localhost:3000

The relevant QUnit Test cases are defined in the test/index.go file.

Sample Apps ported from Javascript/Coffeescript to GopherJS

Look at the Sample Apps to find out what is working and how. Any feedback is welcome !


The normal DOM / Ajax / Deferreds Api is done and can be considered stable. Please look up the index.go file in the test folder to see how it works.