Events
Przykład:
$( "#dataTable tbody tr" ).on( "click", function() {
console.log( $( this ).text() );
});
NOTE: event.stopPropagation
Mouse events
- click
- contextmenu
- dbclick
- hover
- mousedown
- mouseenter
- mouseleave
- mousemove
- mouseover
- mouseup
- ...
Delegated events
$( "#dataTable tbody" ).on( "click", "tr", function() {
console.log( $( this ).text() );
});
Form events
$( "form" ).submit(function( event ) {
if ( $( "input:first" ).val() === "correct" ) {
$( "span" ).text( "Validated..." ).show();
return;
}
$( "span" ).text( "Not valid!" ).show().fadeOut( 1000 );
event.preventDefault();
});