I realise in the following JavaScript code, we need to add a ;
just after $('#myButton').click(function() {})
to let $('.lala').myFunction()
to be called.
$('#myButton').click(function() {})
(function ($) {
$.fn.myFunction = function (opt) {
alert("inside myFunction")
}
})(jQuery);
$('.lala').myFunction()
Why ;
makes a big difference here? I thought in most of the cases ;
between statements can be omitted in JavaScript.