blur (callback)
Called when any element in the set of matched elements loses focus.
<div class="flex gap-sm">
<input type="text" class="input-sm width-lg" id="textbox1" />
<select class="input-sm width-lg" id="select1">
<option value="0">-- Select --</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
webui.ready( () => {
ui("#textbox1, #select1").blur( (e) => {
console.log("Event fired for " + e.target.id);
});
});
change (callback)
Called when the value is changed for any element in the set of matched elements.
<div class="flex gap-sm">
<input type="text" class="input-sm width-lg" id="textbox1" />
<select class="input-sm width-lg" id="select1">
<option value="0">-- Select --</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
webui.ready( () => {
ui("#textbox1, #select1").change( (e) => {
console.log("Event fired for " + e.target.id);
});
});
click (callback)
Called when any element in the set of matched elements receives mouse click events.
<div class="flex gap-sm width-xl"> <div class="container flex-auto height-md border-sm border-dark" id="div1"></div> <div class="container flex-auto height-md border-sm border-dark" id="div2"></div> </div>
webui.ready( () => {
ui(".container").click( (e) => {
console.log("Event fired for " + e.target.id);
});
});
dblclick (callback)
Called when any element in the set of matched elements receives mouse double click events.
<div class="flex gap-sm width-xl"> <div class="container flex-auto height-md border-sm border-dark" id="div1"></div> <div class="container flex-auto height-md border-sm border-dark" id="div2"></div> </div>
webui.ready( () => {
ui(".container").dblclick( (e) => {
console.log("Event fired for " + e.target.id);
});
});
drag (callback)
Called when any draggable element in the set of matched elements changes position during the drag operation.
<div class="border-sm border-dark width-md height-lg-xl" id="dragDropExample">
<div class="flex align-items-center justify-content-center info height-sm cursor-copy" draggable="true" id="dragItem1">
<label>1</label>
</div>
<div class="flex align-items-center justify-content-center success height-sm cursor-copy" draggable="true" id="dragItem2">
<label>2</label>
</div>
<div class="flex align-items-center justify-content-center warning height-sm cursor-copy" draggable="true" id="dragItem3">
<label>3</label>
</div>
</div>
webui.ready( () => {
ui("#dragItem1, #dragItem2, #dragItem3").drag( (e) => {
console.log("drag");
});
});
dragEnd (callback)
Called when the drag an drop operation has completed for any draggable element in the set of matched elements.
<div class="border-sm border-dark width-md height-lg-xl" id="dragDropExample">
<div class="flex align-items-center justify-content-center info height-sm cursor-copy" draggable="true" id="dragItem1">
<label>1</label>
</div>
<div class="flex align-items-center justify-content-center success height-sm cursor-copy" draggable="true" id="dragItem2">
<label>2</label>
</div>
<div class="flex align-items-center justify-content-center warning height-sm cursor-copy" draggable="true" id="dragItem3">
<label>3</label>
</div>
</div>
webui.ready( () => {
ui("#dragItem1, #dragItem2, #dragItem3").dragEnd( (e) => {
console.log("dragEnd");
});
});
dragEnter (callback)
Called when any draggable element in the set of matched elements enters a valid drop target.
<div class="border-sm border-dark width-md height-lg-xl" id="dragDropExample">
<div class="flex align-items-center justify-content-center info height-sm cursor-copy" draggable="true" id="dragItem1">
<label>1</label>
</div>
<div class="flex align-items-center justify-content-center success height-sm cursor-copy" draggable="true" id="dragItem2">
<label>2</label>
</div>
<div class="flex align-items-center justify-content-center warning height-sm cursor-copy" draggable="true" id="dragItem3">
<label>3</label>
</div>
</div>
webui.ready( () => {
ui("#dragDropExample").dragEnter( (e) => {
console.log("dragEnter");
});
});
dragLeave (callback)
Called when any draggable element in the set of matched elements leaves a valid drop target.
<div class="border-sm border-dark width-md height-lg-xl" id="dragDropExample">
<div class="flex align-items-center justify-content-center info height-sm cursor-copy" draggable="true" id="dragItem1">
<label>1</label>
</div>
<div class="flex align-items-center justify-content-center success height-sm cursor-copy" draggable="true" id="dragItem2">
<label>2</label>
</div>
<div class="flex align-items-center justify-content-center warning height-sm cursor-copy" draggable="true" id="dragItem3">
<label>3</label>
</div>
</div>
webui.ready( () => {
ui("#dragDropExample").dragLeave( (e) => {
console.log("dragLeave");
});
});
dragOver (callback)
Called when a draggable element is dragged over any element in the set of matched elements.
<div class="border-sm border-dark width-md height-lg-xl" id="dragDropExample">
<div class="flex align-items-center justify-content-center info height-sm cursor-copy" draggable="true" id="dragItem1">
<label>1</label>
</div>
<div class="flex align-items-center justify-content-center success height-sm cursor-copy" draggable="true" id="dragItem2">
<label>2</label>
</div>
<div class="flex align-items-center justify-content-center warning height-sm cursor-copy" draggable="true" id="dragItem3">
<label>3</label>
</div>
</div>
webui.ready( () => {
ui("#dragDropExample").dragOver( (e) => {
e.preventDefault();
webui(e.target).setControlState("border-dark", "border-info");
});
});
dragStart (callback)
Initiates a drag and drop operation for each draggable element in the set of matched elements.
<div class="border-sm border-dark width-md height-lg-xl" id="dragDropExample">
<div class="flex align-items-center justify-content-center info height-sm cursor-copy" draggable="true" id="dragItem1">
<label>1</label>
</div>
<div class="flex align-items-center justify-content-center success height-sm cursor-copy" draggable="true" id="dragItem2">
<label>2</label>
</div>
<div class="flex align-items-center justify-content-center warning height-sm cursor-copy" draggable="true" id="dragItem3">
<label>3</label>
</div>
</div>
webui.ready( () => {
ui("#dragItem1, #dragItem2, #dragItem3").dragStart( (e) => {
if (e.target.draggable === true) {
e.dataTransfer.setData("exampleData", e.target.id);
console.log("dragStart event data: " + e.target.id);
}
else {
e.preventDefault();
}
});
});
drop (callback)
Called when a draggable element is dropped on any element in the set of matched elements.
<div class="border-sm border-dark width-md height-lg-xl" id="dragDropExample">
<div class="flex align-items-center justify-content-center info height-sm cursor-copy" draggable="true" id="dragItem1">
<label>1</label>
</div>
<div class="flex align-items-center justify-content-center success height-sm cursor-copy" draggable="true" id="dragItem2">
<label>2</label>
</div>
<div class="flex align-items-center justify-content-center warning height-sm cursor-copy" draggable="true" id="dragItem3">
<label>3</label>
</div>
</div>
webui.ready( () => {
ui("#dragDropExample").drop( (e) => {
if (e.target.id === "dragDropExample") {
webui(e.target).setControlState("border-info", "border-dark");
var data = e.dataTransfer.getData("exampleData");
if (data) {
webui(e.target).append(webui("#" + data));
console.log("drop event data: " + data);
}
}
else {
e.preventDefault();
}
});
});
focus (callback)
Called when any element in the set of matched elements gains focus.
<div class="flex gap-sm">
<input type="text" class="input-sm width-lg" id="textbox1" />
<select class="input-sm width-lg" id="select1">
<option value="0">-- Select --</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
webui.ready( () => {
ui("#textbox1, #select1").focus( (e) => {
console.log("Event fired for " + e.target.id);
});
});
focusIn (callback)
Called when any element, its parent, or its child elements in the set of matched elements is about to gain focus.
<div class="flex gap-sm">
<input type="text" class="input-sm width-lg" id="textbox1" />
<select class="input-sm width-lg" id="select1">
<option value="0">-- Select --</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
webui.ready( () => {
ui(".area").focusIn( (e) => {
console.log("Event fired for " + e.target.id);
});
});
focusOut (callback)
Called when any element, its parent, or its child elements in the set of matched elements is about to lose focus.
<div class="flex gap-sm">
<input type="text" class="input-sm width-lg" id="textbox1" />
<select class="input-sm width-lg" id="select1">
<option value="0">-- Select --</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
webui.ready( () => {
ui(".area").focusOut( (e) => {
console.log("Event fired for " + e.target.id);
});
});
hoverIn (callback)
Called when the pointer device enters any element in the set of matched elements.
<div class="flex gap-sm">
<input type="text" class="input-sm width-lg" id="textbox1" />
<select class="input-sm width-lg" id="select1">
<option value="0">-- Select --</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
webui.ready( () => {
ui(".area").hoverIn( (e) => {
console.log("Event fired for " + e.target.id);
});
});
hoverOut (callback)
Called when the pointer device leaves any element in the set of matched elements.
<div class="flex gap-sm">
<input type="text" class="input-sm width-lg" id="textbox1" />
<select class="input-sm width-lg" id="select1">
<option value="0">-- Select --</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
webui.ready( () => {
ui(".area").hoverOut( (e) => {
console.log("Event fired for " + e.target.id);
});
});
keyDown (callback)
Called when any element in the set of matched elements receives keyboard key down events.
<div class="flex gap-sm">
<input type="text" class="input-sm width-lg" id="textbox1" />
<select class="input-sm width-lg" id="select1">
<option value="0">-- Select --</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
webui.ready( () => {
ui("#textbox1, #select1").keyDown( (e) => {
console.log("Event fired for " + e.target.id);
});
});
off (name, callback)
Removes the named event listener for all elements in the set of matched elements, and optionally with a callback.
<div class="flex gap-sm width-xl"> <div class="container flex-auto height-md border-sm border-dark" id="div1"></div> <div class="container flex-auto height-md border-sm border-dark" id="div2"></div> </div>
webui.ready( () => {
function handleEvent(e) {
console.log("Event triggered: " + e.target.id);
ui("#div1").off("click", handleEvent);
}
ui("#div1").on("click", handleEvent);
});
on (name, callback)
Adds an event listener for the named event, and is called when the named event is dispatched by the trigger function for any element in the set of matched elements.
<div class="flex gap-sm width-xl"> <div class="container flex-auto height-md border-sm border-dark" id="div1"></div> <div class="container flex-auto height-md border-sm border-dark" id="div2"></div> </div>
webui.ready( () => {
function handleEvent(e) {
console.log("Event triggered: " + e.target.id);
ui("#div1").off("click", handleEvent);
}
ui("#div1").on("click", handleEvent);
});
resize (callback)
Called when any resizable object in the set of matched elements is resized.
webui.ready( () => {
ui(window).resize( (e) => {
console.log("Window resize event triggered: " + e.timeStamp);
});
});
scroll (callback)
Called when any scrollable object in the set of matched elements is scrolled.
webui.ready( () => {
ui(window).scroll( (e) => {
console.log("Window scroll event triggered: " + e.timeStamp);
});
});
touchEnd (callback)
Called when an element in the set of matched elements receives a touchEnd event.
<div class="height-md width-xl border-sm border-dark transition-long" id="div1"></div>
webui.ready( () => {
ui("#div1").touchEnd( (e) => {
console.log("Touch end event triggered for " + e.target.id);
});
});
touchMove (callback)
Called when an element in the set of matched elements receives a touchMove event.
<div class="height-md width-xl border-sm border-dark transition-long" id="div1"></div>
webui.ready( () => {
ui("#div1").touchMove( (e) => {
console.log("Touch move event triggered for " + e.target.id);
});
});
touchStart (callback)
Called when an element in the set of matched elements receives a touchStart event.
<div class="height-md width-xl border-sm border-dark transition-long" id="div1"></div>
webui.ready( () => {
ui("#div1").touchStart( (e) => {
console.log("Touch start event triggered for " + e.target.id);
});
});
transitionEnd (callback)
Called when an element in the set of matched elements receives a transitionEnd event.
<div class="height-md width-xl border-sm border-dark transition-long" id="div1"></div>
webui.ready( () => {
ui("#div1").transitionEnd( (e) => {
console.log("Transition end event triggered for " + e.target.id);
});
ui("#div1").css("width", "10%");
});
transitionRun (callback)
Called when an element in the set of matched elements receives a transitionRun event.
<div class="height-md width-xl border-sm border-dark transition-long" id="div1"></div>
webui.ready( () => {
ui("#div1").transitionRun( (e) => {
console.log("Transition run event triggered for " + e.target.id);
});
ui("#div1").css("width", "10%");
});
transitionStart (callback)
Called when an element in the set of matched elements receives a transitionStart event.
<div class="height-md width-xl border-sm border-dark transition-long" id="div1"></div>
webui.ready( () => {
ui("#div1").transitionStart( (e) => {
console.log("Transition start event triggered for " + e.target.id);
});
ui("#div1").css("width", "10%");
});
trigger (callback, args)
Dispatches the named event to matching event listerners for all elements in the set of matched elements.
<div class="flex gap-sm"> <div class="container flex-auto height-md border-sm border-dark" id="div1"></div> <div class="container flex-auto height-md border-sm border-dark" id="div2"></div> </div>
webui.ready( () => {
ui(".container").on("customEvent", (e) => {
console.log("Data for event: " + e.detail);
});
ui(".container").trigger("customEvent", "Example data.");
});