trait JQuery extends Object
A facade for the main jQuery object.
This is a reimplementation, very loosely based on the existing scalajs-jquery. It aims to be much more strongly and precisely typed, while being as literal a translation of the functionality of jQuery as possible. It is intentionally pretty close to scalajs-jquery, and many files can be switched over by simply switching the import, but compatibility has *not* been a priority, and a modest number of functions have changed in breaking ways. (This is one reason why I treated this as a rewrite rather than as an evolution of the existing library.)
TODO: as of this writing, this is *quite* incomplete; I am only adding functions as I use them, and at least half of them are currently missing. Pull requests are greatly welcomed. In particular, we are lacking many overloads -- I've added some of them, but many jQuery functions have a considerable number of potential overloads.
Many parameters are polymorphic. We often use | (type union) to define these, but | and UndefOr don't mix, so we often have to spell things out in more detail. Also, you can't use a js.Function or js.ThisFunction in a | expression, because it interferes with the compiler's implicit conversion from a Scala function to a js.Function. Note that there are several common unions such as Selector defined in package.scala.
Things are also often spelled out more explicitly than you might expect, because Scala restricts us to one overload per method with default parameters; this limits our usage of UndefOr.
We don't necessarily spell out every possible overload here, although we've made a serious effort to make every version of the JS calls possible. In some cases, we only have versions that involve some extra parameters. If you find yourself really wanting an overload that takes fewer parameters, pull requests are welcome.
NOTE: discussion on scalajs Gitter, 1/28/15, says that facades should *return* Any, but *take* js.Any *if* the Javascript is going to process the value in any way. This is the guiding principle here.
Also: when a facade function takes a property bag, if it is understood to be name/value pairs in JS, declare it as js.Dictionary[T]. Often, we can constrain T; if not, just put js.Any, and it is at least explicit that it is name/value pairs.
Long-deprecated functions are, by and large, simply omitted. Please see the jQuery documentation to see what to use instead.
- Annotations
- @RawJSType() @native()
- Alphabetic
- By Inheritance
- JQuery
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def add(selector: String, context: Element): JQuery
- def add(selector: ElementDesc): JQuery
Create a new jQuery object with elements added to the set of matched elements.
- def addBack(selector: String = ???): JQuery
Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
- def addClass(func: ThisFunction2[Element, Int, String, String]): JQuery
- def addClass(classNames: String): JQuery
Adds the specified class(es) to each of the set of matched elements.
- def after(func: ThisFunction1[Element, Int, ElementDesc]): JQuery
- def after(func: ThisFunction0[Element, ElementDesc]): JQuery
- def after(content: ElementDesc*): JQuery
Insert content, specified by the parameter, after each element in the set of matched elements.
- def ajaxComplete(handler: Function3[JQueryEventObject, JQueryXHR, JQueryAjaxSettings, Any]): JQuery
Register a handler to be called when Ajax requests complete.
- def ajaxError(handler: Function4[JQueryEventObject, JQueryXHR, JQueryAjaxSettings, String, Any]): JQuery
Register a handler to be called when Ajax requests complete with an error.
- def ajaxSend(handler: Function3[JQueryEventObject, JQueryXHR, JQueryAjaxSettings, Any]): JQuery
Attach a function to be executed before an Ajax request is sent.
- def ajaxStart(handler: Function0[Any]): JQuery
Register a handler to be called when the first Ajax request begins.
- def ajaxStop(handler: Function0[Any]): JQuery
Register a handler to be called when all Ajax requests have completed.
- def ajaxSuccess(handler: Function4[JQueryEventObject, JQueryXHR, JQueryAjaxSettings, Object, Any]): JQuery
Attach a function to be executed whenever an Ajax request completes successfully.
- def animate(properties: Dictionary[Any], options: JQueryAnimationSettings): JQuery
- def animate(properties: Dictionary[Any], duration: |[Number, String], easing: String = ???, complete: ThisFunction0[Element, Any] = ???): JQuery
Perform a custom animation of a set of CSS properties.
- def append(func: ThisFunction2[Element, Int, String, Any]): JQuery
- def append(content: ElementDesc*): JQuery
Insert content, specified by the parameter, to the end of each element in the set of matched elements.
- def appendTo(target: ElementDesc): JQuery
Insert every element in the set of matched elements to the end of the target.
- def apply(x: Int): Element
Shorthand for get(x), lifted from scalajs-jquery
Shorthand for get(x), lifted from scalajs-jquery
- Annotations
- @JSBracketAccess()
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def attr(attributeName: String, func: ThisFunction2[Element, Int, String, AttrVal]): JQuery
- def attr(attributeName: String, v: AttrVal): JQuery
Set an attribute for the set of matched elements.
- def attr(attributes: Dictionary[String]): JQuery
- def attr(attributeName: String): UndefOr[String]
Get the value of an attribute for the first element in the set of matched elements.
Get the value of an attribute for the first element in the set of matched elements.
Note that this returns UndefOr -- it is entirely legal for this to return undefined if the attribute is not present, and that causes things to crash if it is not UndefOr.
- def before(func: ThisFunction2[Element, Integer, String, |[|[String, Element], JQuery]]): JQuery
- def before(content: ElementDesc, addlContent: ElementDesc*): JQuery
Insert content, specified by the parameter, before each element in the set of matched elements.
- def bind(events: Dictionary[ThisFunction1[Element, JQueryEventObject, Any]]): JQuery
- def bind(eventType: String, preventBubble: Boolean): JQuery
- def bind(eventType: String, eventData: Any, handler: ThisFunction1[Element, JQueryEventObject, Any]): JQuery
- def bind(eventType: String, handler: ThisFunction1[Element, JQueryEventObject, Any]): JQuery
Attach a handler to an event for the elements.
- def blur(eventData: Any, handler: EventHandler): JQuery
- def blur(handler: EventHandler): JQuery
- def blur(): JQuery
Bind an event handler to the "blur" JavaScript event, or trigger that event on an element.
- def change(eventData: Any, handler: EventHandler): JQuery
- def change(handler: EventHandler): JQuery
- def change(): JQuery
Bind an event handler to the "change" JavaScript event, or trigger that event on an element.
Bind an event handler to the "change" JavaScript event, or trigger that event on an element.
NOTE: the jQuery documentation is very fuzzy on this point, but implies in an example that "this" gets set appropriately.
- def children(selector: String = ???): JQuery
Get the children of each element in the set of matched elements, optionally filtered by a selector.
- def clearQueue(queueName: String = ???): JQuery
Remove from the queue all items that have not yet been run.
- def click(handler: EventHandler): JQuery
- def click(): JQuery
Bind an event handler to the "click" JavaScript event, or trigger that event on an element.
Bind an event handler to the "click" JavaScript event, or trigger that event on an element.
This is the simpler version, and usually what you want.
- def clone(withDataAndEvents: Boolean, deepWithDataAndEvents: Boolean): JQuery
- def clone(withDataAndEvents: Boolean): JQuery
- def clone(): JQuery
Create a deep copy of the set of matched elements.
Create a deep copy of the set of matched elements.
Note that this requires an override because Scala.Object declares a clone() method which is entirely unrelated.
- Definition Classes
- JQuery → AnyRef
- def closest(selector: String, context: Element): JQuery
- def closest(selector: |[|[String, Element], JQuery]): JQuery
For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
- def contents(): JQuery
Get the children of each element in the set of matched elements, including text and comment nodes.
- def css(properties: Dictionary[Any]): JQuery
- def css(propertyName: String, value: |[String, Int]): JQuery
- def css(propertyNames: Array[String]): Dictionary[String]
- def css(propertyName: String): String
Get the computed style properties for the first element in the set of matched elements.
- def data(): Dictionary[Any]
Calling .data() with no parameters retrieves all of the values as a JavaScript object.
Calling .data() with no parameters retrieves all of the values as a JavaScript object. This object can be safely cached in a variable as long as a new object is not set with .data(obj). Using the object directly to get or set values is faster than making individual calls to .data() to get or set each value.
- def data(key: String): UndefOr[Any]
Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. Undefined if that key is not set.
- def data(obj: Dictionary[Any]): JQuery
- def data(key: String, value: Any): JQuery
Store arbitrary data associated with the matched elements.
Store arbitrary data associated with the matched elements.
undefined is not recognised as a data value. Calls such as .data( "name", undefined ) will return the corresponding data for "name", and is therefore the same as .data( "name" ).
- def dblclick(eventData: Any, handler: EventHandler): JQuery
- def dblclick(handler: EventHandler): JQuery
- def dblclick(): JQuery
Bind an event handler to the "dblclick" JavaScript event.
- def delay(duration: Int, queueName: String = ???): JQuery
Set a timer to delay execution of subsequent items in the queue.
- def dequeue(queueName: String = ???): JQuery
Execute the next function on the queue for the matched elements.
- def detach(selector: String): JQuery
- def detach(): JQuery
Remove the set of matched elements from the DOM.
- def each(func: ThisFunction1[Element, Int, Any]): JQuery
- def each(func: ThisFunction0[Element, Any]): JQuery
Iterate over a jQuery object, executing a function for each matched element.
Iterate over a jQuery object, executing a function for each matched element.
Note that we do not bother with the full jQuery signature, since the "element" parameter simply matches "this".
You can stop the loop from within the callback function by returning false. Otherwise, the return value is irrelevant.
- def empty(): JQuery
Remove all child nodes of the set of matched elements from the DOM.
- def end(): JQuery
End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.
- def eq(index: Integer): JQuery
Reduce the set of matched elements to the one at the specified index.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fadeIn(options: JQueryAnimationSettings): JQuery
- def fadeIn(duration: |[Number, String], easing: String = ???, complete: ThisFunction0[Element, Any] = ???): JQuery
- def fadeIn(easing: String, complete: ThisFunction0[Element, Any]): JQuery
- def fadeIn(easing: String): JQuery
- def fadeIn(): JQuery
Display the matched elements by fading them to opaque.
- def fadeOut(options: JQueryAnimationSettings): JQuery
- def fadeOut(duration: |[Number, String], easing: String = ???, complete: ThisFunction0[Element, Any] = ???): JQuery
- def fadeOut(easing: String, complete: ThisFunction0[Element, Any]): JQuery
- def fadeOut(easing: String): JQuery
- def fadeOut(): JQuery
Hide the matched elements by fading them to transparent.
- def fadeTo(duration: |[String, Number], opacity: Number, easing: String = ???, complete: ThisFunction0[Element, Any] = ???): JQuery
Adjust the opacity of the matched elements.
- def fadeToggle(options: JQueryAnimationSettings): JQuery
- def fadeToggle(duration: |[Number, String], easing: String = ???, complete: ThisFunction0[Element, Any] = ???): JQuery
- def fadeToggle(easing: String, complete: ThisFunction0[Element, Any]): JQuery
- def fadeToggle(easing: String): JQuery
- def fadeToggle(): JQuery
Display or hide the matched elements by animating their opacity.
- def filter(func: ThisFunction1[Element, Int, Boolean]): JQuery
- def filter(func: ThisFunction0[Element, Boolean]): JQuery
- def filter(selector: Selector): JQuery
Reduce the set of matched elements to those that match the selector or pass the function's test.
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def find(selector: Selector): JQuery
Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
- def finish(queue: String = "fx"): JQuery
Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements.
- def first(): JQuery
Reduce the set of matched elements to the first in the set.
- def focus(eventData: Any, handler: EventHandler): JQuery
- def focus(handler: EventHandler): JQuery
- def focus(): JQuery
Bind an event handler to the "focus" JavaScript event, or trigger that event on an element.
- def focusin(eventData: Any, handler: EventHandler): JQuery
- def focusin(handler: EventHandler): JQuery
- def focusin(): JQuery
Bind an event handler to the "focusin" event.
- def focusout(eventData: Any, handler: EventHandler): JQuery
- def focusout(handler: EventHandler): JQuery
- def focusout(): JQuery
Bind an event handler to the "focusout" event.
- def get(): Array[_]
Retrieve the elements matched by the jQuery object.
- def get(index: Int): UndefOr[Element]
Retrieve one of the elements matched by the jQuery object.
Retrieve one of the elements matched by the jQuery object.
If the value of index is out of bounds - less than the negative number of elements or equal to or greater than the number of elements - it returns undefined.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def has(selector: Selector): JQuery
Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
- def hasClass(className: String): Boolean
Determine whether any of the matched elements are assigned the given class.
- def hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def height(value: ThisFunction2[Element, Integer, Integer, |[Number, String]]): JQuery
- def height(value: |[Double, String]): JQuery
Set the CSS height of every matched element.
- def height(): Double
Get the current computed height for the first element in the set of matched elements.
- def hide(duration: |[String, Int], easing: String = ???, complete: Function = ???): JQuery
- def hide(duration: |[String, Int], complete: Function): JQuery
- def hide(): JQuery
Hide the matched elements.
- def hover(handlerInOut: EventHandler): JQuery
Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.
- def hover(handlerIn: EventHandler, handlerOut: EventHandler): JQuery
Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
- def html(func: ThisFunction2[Element, Int, String, String]): JQuery
- def html(t: String): JQuery
Set the HTML contents of every matched element.
- def html(): String
Get the HTML contents of the first element in the set of matched elements.
- def index(selector: ElementDesc): Int
- def index(): Int
Search for a given element from among the matched elements.
- def innerHeight(): Double
Get the current computed inner height (including padding but not border) for the first element in the set of matched elements.
- def innerWidth(): Double
Get the current computed inner width (including padding but not border) for the first element in the set of matched elements.
- def insertAfter(target: ElementDesc): JQuery
Insert every element in the set of matched elements after the target.
- def insertBefore(target: ElementDesc): JQuery
Insert every element in the set of matched elements before the target.
- def is(func: ThisFunction1[Element, Int, Boolean]): Boolean
Note that this overload doesn't precisely match the jQuery documentation; we elide the redundant Element param, since you have Element as the this parameter.
- def is(selector: Selector): Boolean
Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
- def jquery: String
A string containing the jQuery version number.
- def keydown(): JQuery
- def keydown(eventData: Any, handler: EventHandler): JQuery
- def keydown(handler: EventHandler): JQuery
Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element.
- def keypress(): JQuery
- def keypress(eventData: Any, handler: EventHandler): JQuery
- def keypress(handler: EventHandler): JQuery
Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element.
- def keyup(): JQuery
- def keyup(eventData: Any, handler: EventHandler): JQuery
- def keyup(handler: EventHandler): JQuery
Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element.
- def last(): JQuery
Reduce the set of matched elements to the final one in the set.
- def length: Int
The number of elements in the jQuery object.
- def load(url: String, data: |[String, Object], complete: ThisFunction3[Element, String, String, JQueryXHR, Any]): JQuery
- def load(url: String, data: |[String, Object]): JQuery
- def load(url: String): JQuery
Load data from the server and place the returned HTML into the matched element.
- def map(func: ThisFunction1[Element, Int, Any]): JQuery
- def map(func: ThisFunction0[Element, Any]): JQuery
Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
For Scala code, it is often more convenient to use the mapElems() extension function.
Within the callback function, this refers to the current DOM element for each iteration. The function can return an individual data item or an array of data items to be inserted into the resulting set.
If a js.Array is returned, the elements inside the array are inserted into the set. If the function returns null or undefined, no element will be inserted. (Note the implication: this doesn't quite match the usual Scala semantics of map() -- there is a flatten component as well.)
- def mousedown(eventData: Any, handler: EventHandler): JQuery
- def mousedown(handler: EventHandler): JQuery
- def mousedown(): JQuery
Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element.
- def mouseenter(eventData: Any, handler: EventHandler): JQuery
- def mouseenter(handler: EventHandler): JQuery
- def mouseenter(): JQuery
Bind an event handler to the "mouseenter" JavaScript event, or trigger that event on an element.
- def mouseleave(eventData: Any, handler: EventHandler): JQuery
- def mouseleave(handler: EventHandler): JQuery
- def mouseleave(): JQuery
Bind an event handler to the "mouseleave" JavaScript event, or trigger that event on an element.
- def mousemove(eventData: Any, handler: EventHandler): JQuery
- def mousemove(handler: EventHandler): JQuery
- def mousemove(): JQuery
Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element.
- def mouseout(eventData: Any, handler: EventHandler): JQuery
- def mouseout(handler: EventHandler): JQuery
- def mouseout(): JQuery
Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element.
- def mouseover(eventData: Any, handler: EventHandler): JQuery
- def mouseover(handler: EventHandler): JQuery
- def mouseover(): JQuery
Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element.
- def mouseup(eventData: Any, handler: EventHandler): JQuery
- def mouseup(handler: EventHandler): JQuery
- def mouseup(): JQuery
Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def next(selector: String = ???): JQuery
Get the immediately following sibling of each element in the set of matched elements.
Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
- def nextAll(selector: String = ???): JQuery
Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.
- def nextUntil(element: |[Element, JQuery], filter: String = ???): JQuery
- def nextUntil(selector: String, filter: String): JQuery
- def nextUntil(selector: String): JQuery
- def nextUntil(): JQuery
Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.
- def not(func: ThisFunction2[Element, Integer, Element, Boolean]): JQuery
- def not(selector: ElementDesc): JQuery
Remove elements from the set of matched elements.
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def off(): JQuery
- def off(event: JQueryEventObject): JQuery
- def off(eventsMap: Dictionary[EventHandler], selector: String = ???): JQuery
- def off(events: String, handler: EventHandler): JQuery
- def off(events: String, selector: String, handler: EventHandler): JQuery
- def off(events: String, selector: String): JQuery
- def off(events: String): JQuery
Remove an event handler.
- def offset(func: Function2[Integer, JQueryPosition, JQueryPosition]): JQuery
- def offset(coordinates: JQueryPosition): JQuery
- def offset(): JQueryPosition
Get the current coordinates of the first element in the set of matched elements, relative to the document.
- def offsetParent(): JQuery
Get the closest ancestor element that is positioned.
- def on(eventsMap: Dictionary[EventHandler]): JQuery
- def on(eventsMap: Dictionary[EventHandler], selector: String): JQuery
- def on(eventsMap: Dictionary[EventHandler], selector: String, data: Any): JQuery
- def on(events: String): JQuery
- def on(events: String, turnOff: Boolean): JQuery
- def on(events: String, selector: String): JQuery
- def on(events: String, selector: String, data: Any): JQuery
- def on(events: String, selector: String, data: Any, turnOff: Boolean): JQuery
Attach an event handler function for one or more events to the selected elements.
Attach an event handler function for one or more events to the selected elements.
This version of the signature allows you to pass in "false" as the handler. This is kind of magical in jQuery -- it is shorthand for a function that just does "return false", which stops propagation on the event. Note that true is *not* a legal value, only false.
- def on(events: String, handler: Function3[JQueryEventObject, Any, Any, Any]): JQuery
- def on(events: String, handler: Function2[JQueryEventObject, Any, Any]): JQuery
- def on(events: String, handler: ThisFunction3[Element, JQueryEventObject, Any, Any, Any]): JQuery
- def on(events: String, handler: ThisFunction2[Element, JQueryEventObject, Any, Any]): JQuery
- def on(events: String, handler: EventHandler): JQuery
- def on(events: String, selector: String, data: Any, handler: EventHandler): JQuery
Attach an event handler function for one or more events to the selected elements.
Attach an event handler function for one or more events to the selected elements.
Note that this contains overloads for up to 2 "extra" parameters to the handler, but the number is potentially unlimited. If we ever care about more, we could add them.
IMPORTANT: this first signature allows you to specify a sub-selector, and some data to pass. There data parameter is *not* optional -- you must pass something in order for the compiler to pick it up! (At least, put in js.undefined there.) For example, something like:
$("body").on("click", ".element", js.undefined, { (elem:Element, evt:JQueryEventObject) => {...} )
We can't write jQuery's (String, String, ThingFunction1) version of the signature here, because it conflicts with the (String, String, Any) version further down, which does something very different. (jQuery is sometimes too clever for its own good.)
So remember to pass something for the data parameter, in order to get the compiler to do the right thing. If you don't, your function *will* match the (String, String, Any) version of the signature, but it won't work correctly.
- def one(eventsMap: Dictionary[EventHandler]): JQuery
- def one(eventsMap: Dictionary[EventHandler], selector: String): JQuery
- def one(eventsMap: Dictionary[EventHandler], selector: String, data: Any): JQuery
- def one(events: String): JQuery
- def one(events: String, turnOff: Boolean): JQuery
- def one(events: String, selector: String): JQuery
- def one(events: String, selector: String, data: Any): JQuery
- def one(events: String, selector: String, data: Any, turnOff: Boolean): JQuery
- def one(events: String, handler: Function3[JQueryEventObject, Any, Any, Any]): JQuery
- def one(events: String, handler: Function2[JQueryEventObject, Any, Any]): JQuery
- def one(events: String, handler: ThisFunction3[Element, JQueryEventObject, Any, Any, Any]): JQuery
- def one(events: String, handler: ThisFunction2[Element, JQueryEventObject, Any, Any]): JQuery
- def one(events: String, handler: EventHandler): JQuery
- def one(events: String, selector: String, data: Any, handler: EventHandler): JQuery
Attach a handler to an event for the elements.
Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
- def outerHeight(includeMargin: Boolean): Double
- def outerHeight(): Double
Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin.
- def outerWidth(includeMargin: Boolean): Double
- def outerWidth(): Double
Get the current computed width for the first element in the set of matched elements, including padding, border, and optionally margin.
- def parent(): JQuery
- def parent(selector: String): JQuery
Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
TBD: is the parameter really a Selector, or just a String? The JQuery API docs are unclear.
- def parents(): JQuery
- def parents(selector: String): JQuery
Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.
- def parentsUntil(element: |[Element, JQuery], filter: String = ???): JQuery
- def parentsUntil(selector: String, filter: String): JQuery
- def parentsUntil(selector: String): JQuery
- def parentsUntil(): JQuery
Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.
- def position(): JQueryPosition
Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
- def prepend(func: ThisFunction2[Element, Int, String, Selector]): JQuery
- def prepend(contents: ElementDesc*): JQuery
Insert content, specified by the parameters, to the beginning of each element in the set of matched elements.
- def prependTo(target: ElementDesc): JQuery
Insert every element in the set of matched elements to the beginning of the target.
- def prev(selector: UndefOr[String] = js.undefined): JQuery
Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.
- def prevAll(selector: UndefOr[String] = js.undefined): JQuery
Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.
- def prevUntil(element: |[Element, JQuery], filter: String = ???): JQuery
- def prevUntil(selector: String, filter: String): JQuery
- def prevUntil(selector: String): JQuery
- def prevUntil(): JQuery
Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
- def promise(tpe: String = ???, target: Object = ???): JQueryPromise
Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.
- def prop(propertyName: String, func: ThisFunction2[Element, Int, Any, Any]): JQuery
- def prop(properties: Dictionary[Any]): JQuery
- def prop(propertyName: String, value: Any): JQuery
Set one or more properties for the set of matched elements.
- def prop(propertyName: String): UndefOr[Any]
Get the value of a property for the first element in the set of matched elements.
- def propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
- def pushStack(elements: Array[Element], name: String, arguments: Array[Any]): JQuery
- def pushStack(elements: Array[Element]): JQuery
Add a collection of DOM elements onto the jQuery stack.
- def queue(callback: Function1[Function0[Any], Any]): JQuery
- def queue(queueName: String, newQueue: Array[Function]): JQuery
- def queue(newQueue: Array[Function]): JQuery
- def queue(queueName: String = ???): Array[Function]
Show the queue of functions to be executed on the matched elements.
- def ready(handler: Function0[Any]): JQuery
Specify a function to execute when the DOM is fully loaded.
- def remove(childSelector: String): JQuery
- def remove(): JQuery
Remove the set of matched elements from the DOM.
- def removeAttr(attributeName: String): JQuery
Remove an attribute from each element in the set of matched elements.
- def removeClass(func: ThisFunction2[Element, Int, String, String]): JQuery
- def removeClass(classNames: String): JQuery
- def removeClass(): JQuery
Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
- def removeData(list: Array[String]): JQuery
- def removeData(name: String): JQuery
- def removeData(): JQuery
Remove a previously-stored piece of data.
- def removeProp(propertyName: String): JQuery
Remove a property for the set of matched elements.
- def replaceAll(target: ElementDesc): JQuery
Replace each target element with the set of matched elements.
- def replaceWith(func: ThisFunction0[Element, ElementDesc]): JQuery
- def replaceWith(content: ElementDesc): JQuery
Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
- def resize(): JQuery
- def resize(eventData: Any, handler: EventHandler): JQuery
- def resize(func: EventHandler): JQuery
Bind an event handler to the "resize" JavaScript event, or trigger that event on an element.
- def scroll(eventData: Any, handler: EventHandler): JQuery
- def scroll(handler: EventHandler): JQuery
- def scroll(): JQuery
Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element.
- def scrollLeft(value: |[Double, Integer]): JQuery
- def scrollLeft(): Integer
Get the current horizontal position of the scroll bar for the first element in the set of matched elements.
- def scrollTop(value: |[Double, Integer]): JQuery
Set the current vertical position of the scroll bar for each of the set of matched elements.
Set the current vertical position of the scroll bar for each of the set of matched elements.
Note that this intentionally takes Double -- while you usually want to set it to an Int, there are occasions when being able to take a Double (that is, a full JS Number) is convenient in code.
- def scrollTop(): Int
Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.
- def select(eventData: Any, handler: EventHandler): JQuery
- def select(handler: EventHandler): JQuery
- def select(): JQuery
Bind an event handler to the "select" JavaScript event, or trigger that event on an element.
- def serialize(): String
Encode a set of form elements as a string for submission.
- def serializeArray(): Array[JQuerySerializeArrayElement]
Encode a set of form elements as an array of names and values.
- def show(duration: |[String, Int], easing: String = ???, complete: Function = ???): JQuery
- def show(duration: |[String, Int], complete: Function): JQuery
- def show(): JQuery
Hide the matched elements.
- def siblings(selector: String = ???): JQuery
Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
- def slice(start: Integer, end: Integer = ???): JQuery
Reduce the set of matched elements to a subset specified by a range of indices.
- def slideDown(duration: |[String, Int], complete: Function = ???): JQuery
- def slideDown(): JQuery
Display the matched elements with a sliding motion.
- def slideToggle(options: JQueryAnimationSettings): JQuery
- def slideToggle(duration: |[Number, String], easing: String = "swing", complete: ThisFunction0[Element, Any] = ???): JQuery
- def slideToggle(): JQuery
Display or hide the matched elements with a sliding motion.
- def slideUp(duration: |[String, Int], complete: Function = ???): JQuery
- def slideUp(): JQuery
Hide the matched elements with a sliding motion.
- def stop(queue: String, clearQueue: Boolean = false, jumpToEnd: Boolean = false): JQuery
- def stop(clearQueue: Boolean, jumpToEnd: Boolean): JQuery
- def stop(clearQueue: Boolean): JQuery
- def stop(): JQuery
Stop the currently-running animation on the matched elements.
- def submit(eventData: Any, handler: ThisFunction1[Element, JQueryEventObject, Any]): JQuery
- def submit(handler: ThisFunction1[Element, JQueryEventObject, Any]): JQuery
- def submit(): JQuery
Bind an event handler to the "submit" JavaScript event, or trigger that event on an element.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def text(func: Function2[Int, String, String]): JQuery
- def text(t: String): JQuery
Set the content of each element in the set of matched elements to the specified text.
- def text(): String
Get the combined text contents of each element in the set of matched elements, including their descendants.
- def toArray(): Array[Element]
Retrieve all the elements contained in the jQuery set, as an array.
- def toLocaleString(): String
- Definition Classes
- Object
- def toString(): String
- Definition Classes
- AnyRef → Any
- def toggleClass(func: Function3[Integer, String, Boolean, String], state: Boolean): JQuery
- def toggleClass(func: Function3[Integer, String, Boolean, String]): JQuery
- def toggleClass(state: Boolean): JQuery
- def toggleClass(className: String, state: Boolean = ???): JQuery
- def toggleClass(): JQuery
Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
- def trigger(event: JQueryEventObject, extraParameters: Any*): JQuery
- def trigger(eventType: String, extraParameters: Any*): JQuery
Execute all handlers and behaviors attached to the matched elements for the given event type.
- def triggerHandler(event: JQueryEventObject, extraParameters: Any*): JQuery
- def triggerHandler(eventType: String, extraParameters: Any*): JQuery
Execute all handlers attached to an element for an event.
- def unbind(eventType: String, handler: ThisFunction1[Element, JQueryEventObject, Any] = ???): JQuery
- def unbind(eventType: String, falsing: Boolean): JQuery
- def unbind(event: JQueryEventObject): JQuery
- def unbind(): JQuery
Remove a previously-attached event handler from the elements.
- def unwrap(): JQuery
Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
- def update(x: Int, v: Element): Unit
Shorthand modifier, lifted from scalajs-jquery.
Shorthand modifier, lifted from scalajs-jquery.
- Annotations
- @JSBracketAccess()
- def val(func: Function2[Int, String, String]): JQuery
- def val(value: String): JQuery
- def val(value: Array[String]): JQuery
- def val(): Dynamic
Get the value of this JQuery.
Get the value of this JQuery.
"value" is highly context-dependent. The signature is loose because it can return a String, a Number (?) or an Array, depending on circumstances. See the extension methods in JQueryExtensions for more strongly-typed versions that you can use when you expect a specific return type.
- def value(func: Function2[Int, String, String]): JQuery
- Annotations
- @JSName("val")
- def value(value: String): JQuery
- Annotations
- @JSName("val")
- def value(value: Array[String]): JQuery
- Annotations
- @JSName("val")
- def value(): Dynamic
- Annotations
- @JSName("val")
- def valueOf(): Any
- Definition Classes
- Object
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def width(value: ThisFunction2[Element, Integer, Integer, |[Number, String]]): JQuery
- def width(value: |[Double, String]): JQuery
Set the CSS width of every matched element.
- def width(): Double
Get the current computed width for the first element in the set of matched elements.
- def wrap(func: ThisFunction1[Element, Integer, |[String, JQuery]]): JQuery
- def wrap(wrappingElement: |[|[String, Element], JQuery]): JQuery
Wrap an HTML structure around each element in the set of matched elements.
- def wrapAll(func: ThisFunction1[Element, Integer, |[String, JQuery]]): JQuery
- def wrapAll(wrappingElement: |[|[String, Element], JQuery]): JQuery
Wrap an HTML structure around all elements in the set of matched elements.
- def wrapInner(func: ThisFunction1[Element, Integer, |[String, JQuery]]): JQuery
- def wrapInner(wrappingElement: |[|[String, Element], JQuery]): JQuery
Wrap an HTML structure around the content of each element in the set of matched elements.