Events

<< Click to Display Table of Contents >>

Navigation:  Using script in HTML document >

Events

Supported element events:

 

onmousemove - mouse is moved over an element

onclick - element is clicked

ondblclick - element is double-clicked

onmouseover - mouse enters an element

onmouseout - mouse leaves an element

onmousedown - left button pressed

onmouseup - left button released

onchange - for input elements

onblur - element lose focus (for input element)

onscroll - element was scrolled

 

 

Events fired on the draggable target (the source element):

ondragstart - occurs when the user starts to drag an element

ondrag - occurs when an element is being dragged

ondragend - occurs when the user has finished dragging the element

 

Events fired on the drop target:

ondragenter - mouse enters an element while dragging

ondragleave - mouse leaves and element while dragging

ondrop - other element is dropped on element

 

Example

Set div semitransparent when other element is dragged over it.

 
$('mydiv').on('dragenter', 'if Event.Target.tag=''div'' then Event.Target.css(''opacity: 0.5'');');
$('mydiv').on('dragleave', 'if Event.Target.tag=''div'' then Event.Target.css(''opacity: 1'');');