O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The close chat control

To handle the user interaction when clicking on the X control to close the live chat feature, we set up an event listener to handle the click event of the close control:

  closeControl := env.Document.GetElementByID("chatboxCloseControl").(*dom.HTMLDivElement)  closeControl.AddEventListener("click", false, func(event dom.Event) {    CloseChat(env)  })

We get the div element that represents the close control by calling the GetElementByID method on the env.Document object, specifying the ID "chatboxCloseControl". We attach an event listener, to the close control, on the click event, which will call the CloseChat function.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required