Skip to content

Latest commit

 

History

History
310 lines (193 loc) · 5.34 KB

File metadata and controls

310 lines (193 loc) · 5.34 KB

Module Control.Monad.Eff.JQuery

This module defines foreign types and functions for working with the jQuery library.

JQuery

data JQuery :: *

The type of collections of jQuery-wrapped nodes.

JQueryEvent

data JQueryEvent :: *

Type of jQuery event objects.

Selector

type Selector = String

A type synonym to help readability of type signatures.

ready

ready :: forall eff a. Eff (dom :: DOM | eff) a -> Eff (dom :: DOM | eff) JQuery

Run a function when the document is loaded.

select

select :: forall eff. Selector -> Eff (dom :: DOM | eff) JQuery

Wrapper function for jQuery selection $('..')

find

find :: forall eff. Selector -> JQuery -> Eff (dom :: DOM | eff) JQuery

Find child nodes matching a selector

parent

parent :: forall eff. JQuery -> Eff (dom :: DOM | eff) JQuery

Get the parent elements.

closest

closest :: forall eff. Selector -> JQuery -> Eff (dom :: DOM | eff) JQuery

Find the closest element matching the selector.

create

create :: forall eff. String -> Eff (dom :: DOM | eff) JQuery

Create an element.

setAttr

setAttr :: forall eff a. String -> a -> JQuery -> Eff (dom :: DOM | eff) JQuery

Set a single attribute.

attr

attr :: forall eff attr. {  | attr } -> JQuery -> Eff (dom :: DOM | eff) JQuery

Set multiple attributes.

css

css :: forall eff css. {  | css } -> JQuery -> Eff (dom :: DOM | eff) JQuery

Set CSS properties.

hasClass

hasClass :: forall eff. String -> JQuery -> Eff (dom :: DOM | eff) Boolean

Test if an element has a CSS class.

toggleClass

toggleClass :: forall eff. String -> JQuery -> Eff (dom :: DOM | eff) JQuery

Toggle the specified CSS class.

setClass

setClass :: forall eff. String -> Boolean -> JQuery -> Eff (dom :: DOM | eff) JQuery

Set the specified CSS class.

addClass

addClass :: forall eff. String -> JQuery -> Eff (dom :: DOM | eff) JQuery

Add the specified CSS class.

removeClass

removeClass :: forall eff. String -> JQuery -> Eff (dom :: DOM | eff) JQuery

Remove the specified CSS class.

setProp

setProp :: forall a eff. String -> a -> JQuery -> Eff (dom :: DOM | eff) JQuery

Set a single property.

getProp

getProp :: forall eff. String -> JQuery -> Eff (dom :: DOM | eff) Foreign

Get a property value.

append

append :: forall eff. JQuery -> JQuery -> Eff (dom :: DOM | eff) JQuery

Append the first node as a child node of the second.

remove

remove :: forall eff. JQuery -> Eff (dom :: DOM | eff) JQuery

Remove selected elements.

clear

clear :: forall eff. JQuery -> Eff (dom :: DOM | eff) JQuery

Remove child elements.

before

before :: forall eff. JQuery -> JQuery -> Eff (dom :: DOM | eff) JQuery

Insert an element before another.

appendText

appendText :: forall eff. String -> JQuery -> Eff (dom :: DOM | eff) JQuery

Append text as a child node.

body

body :: forall eff. Eff (dom :: DOM | eff) JQuery

Get the document body node.

getText

getText :: forall eff. JQuery -> Eff (dom :: DOM | eff) String

Get the text content of an element.

setText

setText :: forall eff. String -> JQuery -> Eff (dom :: DOM | eff) JQuery

Set the text content of an element.

getValue

getValue :: forall eff. JQuery -> Eff (dom :: DOM | eff) Foreign

Get the value of a form element.

setValue

setValue :: forall eff a. a -> JQuery -> Eff (dom :: DOM | eff) JQuery

Set the value of a form element.

toggle

toggle :: forall eff. JQuery -> Eff (dom :: DOM | eff) JQuery

Toggle visibility of an element.

setVisible

setVisible :: forall eff. Boolean -> JQuery -> Eff (dom :: DOM | eff) JQuery

Set the visibility of an element.

hide

hide :: forall eff. JQuery -> Eff (dom :: DOM | eff) JQuery

Hide elements.

display

display :: forall eff. JQuery -> Eff (dom :: DOM | eff) JQuery

Show elements.

on

on :: forall eff a. String -> (JQueryEvent -> JQuery -> Eff (dom :: DOM | eff) a) -> JQuery -> Eff (dom :: DOM | eff) JQuery

Register an event handler.

on'

on' :: forall eff a. String -> Selector -> (JQueryEvent -> JQuery -> Eff (dom :: DOM | eff) a) -> JQuery -> Eff (dom :: DOM | eff) JQuery

Register an event handler for elements matching a selector.

preventDefault

preventDefault :: forall eff. JQueryEvent -> Eff (dom :: DOM | eff) Unit

Prevent the default action for an event.

stopPropagation

stopPropagation :: forall eff. JQueryEvent -> Eff (dom :: DOM | eff) Unit

Stop propagation an event.

stopImmediatePropagation

stopImmediatePropagation :: forall eff. JQueryEvent -> Eff (dom :: DOM | eff) Unit

Stop immediate propagation an event.