1$( "#dataTable tbody tr" ).on( "click", function() {
2 console.log( $( this ).text() );
3});
4
1// There are quite a few abstracted versions of the following
2$('element').on('event', function() {
3 // Do something
4});
5
6// Where 'event' is something such as 'click', 'hover' etc
7
8// They are abstracted as seen below
9$('element').click(function(){
10 // Do something
11});
12$('element').hover(function(){
13 // Do something
14});
15
16// etc...
1.click() //on click event
2
3.dblclick() // on double click
4
5.focus(), .focusin(), .focusout()
6
7.hover()
8
9.keydown(), .keyup(), .keypress()
10
11.mousedown(), .mouseup()
12
13.mousemove()
14
15.ready() // after page is completly loaded
1<!DOCTYPE html>
2<html>
3<head>
4<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
5<script>
6$(document).ready(function(){
7 $("p").click(function(){
8 $(this).hide();
9 });
10});
11</script>
12</head>
13<body>
14
15<p>If you click on me, I will disappear.</p>
16<p>Click me away!</p>
17<p>Click me too!</p>
18
19</body>
20</html>