Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created October 5, 2018 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goofmint/ada01b0350c30e3fb6dd19084ccbef3d to your computer and use it in GitHub Desktop.
Save goofmint/ada01b0350c30e3fb6dd19084ccbef3d to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"syscall/js"
"strconv"
)
func main() {
num1 := js.Global().Get("document").
Call("querySelector", "#num1").
Get("value").
String()
i, _ := strconv.Atoi(num1)
fmt.Println(i)
num2 := js.Global().Get("document").
Call("querySelector", "#num2").
Get("value").
String()
j, _ := strconv.Atoi(num2)
js.Global().Get("document").
Call("querySelector", "#res").
Set("value", i + j)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment