Documentation
¶
Index ¶
- func AddClass(elem string, class string)
- func AddElementTo(target, elem HTMLElement)
- func AddEventListener(elem string, event string, fn func())
- func AddNewStyleElement(style string)
- func AddToBody(element HTMLElement)
- func GetString(elem string, value string) string
- func Hide(elem string)
- func Log(message ...string)
- func RemoveAllChildElementsFrom(target HTMLElement)
- func RemoveClass(elem string, class string)
- func SetFocus(elem string)
- func SetValue(elem string, key string, value string)
- func Show(elem string)
- func ShowAlert(msg string)
- type HTMLElement
- func CreateButton(text string) HTMLElement
- func CreateDiv() HTMLElement
- func CreateElement(element string) HTMLElement
- func CreateImg(src string) HTMLElement
- func CreateParagraph() HTMLElement
- func CreateParagraphWithText(text string) HTMLElement
- func GetElementById(elem string) HTMLElement
- func GetElementValue(elem string, value string) HTMLElement
- func ReplaceClasses(element HTMLElement, classes ...string) HTMLElement
- func WrapElementWithNewDiv(element HTMLElement, divClasses ...string) HTMLElement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddClass ¶
----------------------------------------------------------------------------
Adds a CSS class to the specified element
func AddElementTo ¶
func AddElementTo(target, elem HTMLElement)
----------------------------------------------------------------------------
Adds the specified element to the target element
func AddEventListener ¶
----------------------------------------------------------------------------
Wraps a Go function and sets it as the callback for the specified event on the target element
func AddNewStyleElement ¶ added in v0.0.3
func AddNewStyleElement(style string)
----------------------------------------------------------------------------
Creates a new style element for the page
func AddToBody ¶
func AddToBody(element HTMLElement)
----------------------------------------------------------------------------
Adds the specified element directly to the document body.
func GetString ¶
----------------------------------------------------------------------------
Gets the specified value from the target element as a string
func Hide ¶
func Hide(elem string)
----------------------------------------------------------------------------
Toggles display to "none" on the specified element
func Log ¶
func Log(message ...string)
----------------------------------------------------------------------------
Log calls JavaScript console.log in the browser.
func RemoveAllChildElementsFrom ¶ added in v0.0.4
func RemoveAllChildElementsFrom(target HTMLElement)
----------------------------------------------------------------------------
Removes all the child elements from this element
func RemoveClass ¶
----------------------------------------------------------------------------
Removes the specified CSS class from the target element
func SetFocus ¶
func SetFocus(elem string)
----------------------------------------------------------------------------
Calls "focus()" on the target element
func SetValue ¶
----------------------------------------------------------------------------
Sets the specified key to the given value on the target element
Types ¶
type HTMLElement ¶
----------------------------------------------------------------------------
func CreateButton ¶
func CreateButton(text string) HTMLElement
----------------------------------------------------------------------------
Creates a "button" element
func CreateDiv ¶
func CreateDiv() HTMLElement
----------------------------------------------------------------------------
Creates and returns a new "div" element
func CreateElement ¶
func CreateElement(element string) HTMLElement
----------------------------------------------------------------------------
Creates the specified element type
func CreateImg ¶
func CreateImg(src string) HTMLElement
----------------------------------------------------------------------------
func CreateParagraph ¶
func CreateParagraph() HTMLElement
----------------------------------------------------------------------------
Creates and returns a new "p" element
func CreateParagraphWithText ¶
func CreateParagraphWithText(text string) HTMLElement
----------------------------------------------------------------------------
Creates and returns a new "p" with the innerText set to the given text value
func GetElementById ¶
func GetElementById(elem string) HTMLElement
----------------------------------------------------------------------------
Attempt to find an element with the given Id
func GetElementValue ¶
func GetElementValue(elem string, value string) HTMLElement
----------------------------------------------------------------------------
Gets the specified value from the target element
func ReplaceClasses ¶
func ReplaceClasses(element HTMLElement, classes ...string) HTMLElement
----------------------------------------------------------------------------
Replaces all the classes for the element with the provided list
func WrapElementWithNewDiv ¶
func WrapElementWithNewDiv(element HTMLElement, divClasses ...string) HTMLElement
----------------------------------------------------------------------------
Wraps an existing element in a new div of the type specified