Skip to main content
Question Protected by Sheldore

Is there any difference between the following code?

$('#whatever').on('click', function() {
     /* your code here */
});

and

$('#whatever').click(function() {
     /* your code here */
});

Is there any difference between the following code?

$('#whatever').on('click', function()

and

$('#whatever').click(function()

Is there any difference between the following code?

$('#whatever').on('click', function() {
     /* your code here */
});

and

$('#whatever').click(function() {
     /* your code here */
});
format code
Source Link
cha0site
  • 10.7k
  • 3
  • 34
  • 51

Is there any difference between the following code?

$('#whatever').on('click', function()

$('#whatever').on('click', function() and

$('#whatever').click(function() ?

$('#whatever').click(function()

Is there any difference between following code?

$('#whatever').on('click', function() and

$('#whatever').click(function() ?

Is there any difference between the following code?

$('#whatever').on('click', function()

and

$('#whatever').click(function()

Is there any difference between following code?

$('#whatever').on('click', function() and   

$('#whatever').click(function() ?

Is there any difference between $('#whatever').on('click', function() and  $('#whatever').click(function() ?

Is there any difference between following code?

$('#whatever').on('click', function() and 

$('#whatever').click(function() ?

Source Link
Ben G
  • 26.5k
  • 34
  • 106
  • 174
Loading